[Fix] Fixed NPE in MapOfLists and MapOfSets size(T)

This commit is contained in:
Robert von Burg 2021-03-30 20:14:51 +02:00
parent 210cfb8be9
commit 855034570e
2 changed files with 2 additions and 2 deletions

View File

@ -117,7 +117,7 @@ public class MapOfLists<T, U> {
public int size(T t) {
List<U> list = this.mapOfLists.get(t);
if (list.size() == 0)
if (list == null || list.size() == 0)
return 0;
return list.size();
}

View File

@ -135,7 +135,7 @@ public class MapOfSets<T, U> {
public int size(T t) {
Set<U> set = this.mapOfSets.get(t);
if (set.size() == 0)
if (set == null || set.size() == 0)
return 0;
return set.size();
}