Merge branch 'room-fix-nullcheck' into 'master'

[Room] Null check if room name is null

See merge request famedly/famedlysdk!111
This commit is contained in:
Christian Pauly 2019-10-25 12:09:43 +00:00
commit 72c3cafdd8

View file

@ -87,7 +87,7 @@ class Room {
/// The name of the room if set by a participant.
String get name {
if (states["m.room.name"] != null &&
!states["m.room.name"].content["name"].isEmpty)
!(states["m.room.name"].content["name"]?.isEmpty ?? true))
return states["m.room.name"].content["name"];
if (canonicalAlias != null && !canonicalAlias.isEmpty)
return canonicalAlias.substring(1, canonicalAlias.length).split(":")[0];