neilalexander / seaglass

A truly native Matrix client for macOS - written in Swift/Cocoa, with E2E encryption support
Other
529 stars 34 forks source link

Seaglass crashes when "Homeserver" UserDefault is set to an invalid URL #118

Closed aaronraimist closed 5 years ago

aaronraimist commented 5 years ago

@peter2121 solved it by changing let homeserver = URL(string: defaults.string(forKey: "Homeserver") ?? "https://matrix.org")!.host ?? "matrix.org" to let homeserver = URL(string: defaults.string(forKey: "Homeserver") ?? "https://matrix.org")?.host ?? "matrix.org"

in LoginViewController.swift

michaelsmoody commented 5 years ago

I suspect this is what I'm experiencing right now. I attempted to change the home server today, due to the matrix.org issue, and when I removed the custom homeserver entry, and restarted Seaglass, it now crashes on startup. Platform is macOS 10.14.3, with install via brew. I'm not sure where the "settings" are stored on macOS to remove them, as reinstalling the application does not fix the crash.

aaronraimist commented 5 years ago

@michaelsmoody A quick fix would be to open Terminal and type in defaults write eu.neilalexander.seaglass "Homeserver" "https://matrix.org". The issue is caused by setting a blank url or an invalid url so just avoid clearing that text field. Even if you just put in https://google.com, it won't be a real server but it shouldn't crash.

michaelsmoody commented 5 years ago

Excellent, that worked perfectly to get me back up and running. (TODO on my side, research the defaults command. I dig into the inner workings, but haven't messed with that command much). Thanks again.