From c33350f7966cc89418ec36ef4b4000f36893dd5d Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Wed, 28 Aug 2019 12:32:50 +0200 Subject: [PATCH] [Room] Heroes null check --- lib/src/Room.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/Room.dart b/lib/src/Room.dart index ce67e25..88cc2fc 100644 --- a/lib/src/Room.dart +++ b/lib/src/Room.dart @@ -71,7 +71,7 @@ class Room { return states["m.room.name"].content["name"]; if (canonicalAlias != null && !canonicalAlias.isEmpty) return canonicalAlias.substring(1, canonicalAlias.length).split(":")[0]; - if (mHeroes.length > 0) { + if (mHeroes != null && mHeroes.length > 0) { String displayname = ""; for (int i = 0; i < mHeroes.length; i++) { User hero = states[mHeroes[i]] != null @@ -93,7 +93,7 @@ class Room { MxContent get avatar { if (states["m.room.avatar"] != null) return MxContent(states["m.room.avatar"].content["url"]); - if (mHeroes.length == 1 && states[mHeroes[0]] != null) + if (mHeroes != null && mHeroes.length == 1 && states[mHeroes[0]] != null) return states[mHeroes[0]].asUser.avatarUrl; return MxContent(""); }