fix: Missing null check in get single room method

This commit is contained in:
Christian Pauly 2022-05-11 09:45:01 +02:00
parent 54f87402b2
commit b8ea213f73
2 changed files with 4 additions and 4 deletions

View File

@ -475,7 +475,7 @@ class FluffyBoxDatabase extends DatabaseApi {
.toList(); .toList();
final rawStates = await _roomStateBox.getAll(dbKeys); final rawStates = await _roomStateBox.getAll(dbKeys);
for (final rawState in rawStates) { for (final rawState in rawStates) {
if (rawState == null) continue; if (rawState == null || rawState[''] == null) continue;
room.setState(Event.fromJson(copyMap(rawState['']), room)); room.setState(Event.fromJson(copyMap(rawState['']), room));
} }
} }

View File

@ -522,7 +522,7 @@ class FamedlySdkHiveDatabase extends DatabaseApi {
// Get raw room from database: // Get raw room from database:
final roomData = await _roomsBox.get(roomId); final roomData = await _roomsBox.get(roomId);
if (roomData == null) return null; if (roomData == null) return null;
final room = Room.fromJson(copyMap(roomData), client); final room = Room.fromJson(convertToJson(roomData), client);
// Get important states: // Get important states:
if (loadImportantStates) { if (loadImportantStates) {
@ -533,8 +533,8 @@ class FamedlySdkHiveDatabase extends DatabaseApi {
dbKeys.map((key) => _roomStateBox.get(key)), dbKeys.map((key) => _roomStateBox.get(key)),
); );
for (final rawState in rawStates) { for (final rawState in rawStates) {
if (rawState == null) continue; if (rawState == null || rawState[''] == null) continue;
room.setState(Event.fromJson(copyMap(rawState['']), room)); room.setState(Event.fromJson(convertToJson(rawState['']), room));
} }
} }