NDT: Prevent NPE on JSON parse of bad/empty input (ticket #2672)

This commit is contained in:
zzz
2019-12-02 17:45:22 +00:00
parent f7a2d23f1e
commit 7cfc16ca36

View File

@ -29,6 +29,8 @@ public class JSONUtils {
public static String getValueFromJsonObj(String jsonTxt, String key) {
JSONValue jsonParser = new JSONValue();
Map json = (Map)jsonParser.parse(new String(jsonTxt));
if (json == null)
return null;
Iterator iter = json.entrySet().iterator();
while(iter.hasNext()){
Map.Entry entry = (Map.Entry)iter.next();