diff --git a/core/src/main/scala/com/nutomic/ensichat/core/util/Database.scala b/core/src/main/scala/com/nutomic/ensichat/core/util/Database.scala index 8cd4a3f..3fa054c 100644 --- a/core/src/main/scala/com/nutomic/ensichat/core/util/Database.scala +++ b/core/src/main/scala/com/nutomic/ensichat/core/util/Database.scala @@ -171,7 +171,10 @@ class Database(path: File, settings: SettingsInterface, callbackInterface: Callb val map = Await.result(db.run(knownDevices.result), Duration.Inf).toMap connections .toList - .sortBy(map(_).getMillis) + .sortBy { c => + val duration = map.get(c) + duration.map(_.getMillis).getOrElse(0L) + } .reverse }