[States] Return null on null key

This commit is contained in:
Christian Pauly 2020-02-14 13:16:26 +00:00
parent e2fde3fa92
commit 8e0373cdb9

View file

@ -9,6 +9,7 @@ class StatesMap {
/// If you just enter a MatrixID, it will try to return the corresponding m.room.member event.
dynamic operator [](String key) {
//print("[Warning] This method will be depracated in the future!");
if (key == null) return null;
if (key.startsWith("@") && key.contains(":")) {
if (!states.containsKey("m.room.member")) states["m.room.member"] = {};
return states["m.room.member"][key];