Added NPE guard

This commit is contained in:
Marcin Grzejszczak
2019-11-20 14:15:30 +01:00
parent 24b997f765
commit 6bd0e8cc60

View File

@@ -21,6 +21,7 @@ import java.lang.reflect.Field;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -91,6 +92,9 @@ public class ContractExchangeHandler
@SuppressWarnings("unchecked")
Map<String, Object> map = (((Map<String, Map<String, Object>>) ReflectionUtils
.getField(field, null)).get(index));
if (map == null) {
return new HashMap<>();
}
return map;
}