Potentially fix crash

pull/220/head
nielsandriesse 5 years ago
parent 89e18e220d
commit eebecb5248

@ -28,7 +28,9 @@ public class LokiDotNetAPI : NSObject {
private static func getAuthTokenFromDatabase(for server: String) -> String? {
var result: String? = nil
storage.dbReadConnection.read { transaction in
result = transaction.object(forKey: server, inCollection: authTokenCollection) as! String?
if transaction.hasObject(forKey: server, inCollection: authTokenCollection) {
result = transaction.object(forKey: server, inCollection: authTokenCollection) as? String
}
}
return result
}

Loading…
Cancel
Save