add null safety to constructor

This commit is contained in:
marhali 2022-02-03 11:21:30 +01:00
parent 805ece0fb0
commit 41d77814dd

View File

@ -1,5 +1,7 @@
package thito.nodeflow.config; package thito.nodeflow.config;
import org.jetbrains.annotations.Nullable;
import java.util.*; import java.util.*;
public class MapSection extends HashMap<String, Object> implements Section { public class MapSection extends HashMap<String, Object> implements Section {
@ -10,9 +12,12 @@ public class MapSection extends HashMap<String, Object> implements Section {
super(); super();
} }
public MapSection(Map<?, ?> m) { public MapSection(@Nullable Map<?, ?> m) {
super(); super();
m.forEach((key, value) -> put(String.valueOf(key), value));
if(m != null) {
m.forEach((key, value) -> put(String.valueOf(key), value));
}
} }
protected void setParent(Section parent, String name) { protected void setParent(Section parent, String name) {