Skip to content
This repository has been archived by the owner on Mar 11, 2022. It is now read-only.

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

Closed
2 tasks
aaronraimist opened this issue Apr 9, 2019 · 3 comments · Fixed by #126
Closed
2 tasks

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

aaronraimist opened this issue Apr 9, 2019 · 3 comments · Fixed by #126
Labels
bug Something isn't working

Comments

@aaronraimist
Copy link
Collaborator

  • User's shouldn't be able to enter an invalid URL using the interface
  • If they do set an invalid URL, Seaglass shouldn't crash

@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
Copy link

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
Copy link
Collaborator Author

aaronraimist commented Apr 12, 2019

@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
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
2 participants