fix: Don't fail sync if a presence event has an empty presence field

This commit is contained in:
morguldir 2024-04-12 11:33:53 +02:00 committed by Krille
parent df0a67e3b1
commit df6c11775d
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652
1 changed files with 2 additions and 1 deletions

View File

@ -31,7 +31,8 @@ class PresenceContent {
PresenceContent.fromJson(Map<String, Object?> json)
: presence = PresenceType.values.firstWhere(
(p) => p.toString().split('.').last == json['presence']),
(p) => p.toString().split('.').last == json['presence'],
orElse: () => PresenceType.offline),
lastActiveAgo = json.tryGet<int>('last_active_ago'),
statusMsg = json.tryGet<String>('status_msg'),
currentlyActive = json.tryGet<bool>('currently_active');