Merge branch 'states-fix-return-null' into 'master'
[States] Return null on null key See merge request famedly/famedlysdk!187
This commit is contained in:
commit
0f68b60f16
|
@ -9,6 +9,7 @@ class StatesMap {
|
||||||
/// If you just enter a MatrixID, it will try to return the corresponding m.room.member event.
|
/// If you just enter a MatrixID, it will try to return the corresponding m.room.member event.
|
||||||
dynamic operator [](String key) {
|
dynamic operator [](String key) {
|
||||||
//print("[Warning] This method will be depracated in the future!");
|
//print("[Warning] This method will be depracated in the future!");
|
||||||
|
if (key == null) return null;
|
||||||
if (key.startsWith("@") && key.contains(":")) {
|
if (key.startsWith("@") && key.contains(":")) {
|
||||||
if (!states.containsKey("m.room.member")) states["m.room.member"] = {};
|
if (!states.containsKey("m.room.member")) states["m.room.member"] = {};
|
||||||
return states["m.room.member"][key];
|
return states["m.room.member"][key];
|
||||||
|
|
Loading…
Reference in a new issue