[User] fix null statekey

This commit is contained in:
Christian Pauly 2019-11-07 09:46:18 +00:00
parent d43bd6a065
commit 3a19bfb542
1 changed files with 3 additions and 1 deletions

View File

@ -106,7 +106,9 @@ class User extends RoomState {
/// Returns the displayname or the local part of the Matrix ID if the user
/// has no displayname.
String calcDisplayname() => (displayName == null || displayName.isEmpty)
? stateKey.replaceFirst("@", "").split(":")[0]
? (stateKey != null
? stateKey.replaceFirst("@", "").split(":")[0]
: "Unknown User")
: displayName;
/// Call the Matrix API to kick this user from this room.