[Event] Return empty map

This commit is contained in:
Christian Pauly 2019-08-29 08:57:43 +02:00
parent 7edffb1219
commit 6117606b28

View file

@ -66,11 +66,10 @@ class RawEvent {
this.room}); this.room});
static Map<String, dynamic> getMapFromPayload(dynamic payload) { static Map<String, dynamic> getMapFromPayload(dynamic payload) {
print("getMapFromPayload: $payload"); if (payload == null || payload == "") return {};
if (payload == null || (payload is String && payload.isEmpty)) return null;
if (payload is String) return json.decode(payload); if (payload is String) return json.decode(payload);
if (payload is Map<String, dynamic>) return payload; if (payload is Map<String, dynamic>) return payload;
return null; return {};
} }
/// Get a State event from a table row or from the event stream. /// Get a State event from a table row or from the event stream.