prevent deref of NIL if Dependencies section exists but is empty.

This commit is contained in:
Norayr Chilingarian 2024-07-22 19:53:53 +04:00
parent 9aae54c17e
commit 7278ee3f52

View file

@ -367,20 +367,22 @@ BEGIN
IF foundDepSection THEN IF foundDepSection THEN
WHILE rootObj # NIL DO WHILE rootObj # NIL DO
depsValue := rootObj.value; depsValue := rootObj.value;
IF depsValue IS Json.Obj THEN IF depsValue # NIL THEN
singleDep := depsValue(Json.Obj); IF depsValue IS Json.Obj THEN
WHILE singleDep # NIL DO singleDep := depsValue(Json.Obj);
IF singleDep IS Json.Obj THEN WHILE singleDep # NIL DO
depObj := singleDep(Json.Obj); IF singleDep IS Json.Obj THEN
depName := depObj.name; depObj := singleDep(Json.Obj);
depVersion := depObj.value(Json.Str).str; depName := depObj.name;
IF depstrlist = NIL THEN depstrlist := StringList.Create() END; depVersion := depObj.value(Json.Str).str;
depstrlist.AppendString(depstrlist, depName^); IF depstrlist = NIL THEN depstrlist := StringList.Create() END;
singleDep := depObj.next; (* Move to the next dependency *) depstrlist.AppendString(depstrlist, depName^);
END; singleDep := depObj.next; (* Move to the next dependency *)
END; (* End of inner WHILE loop for dependencies *) END;
RETURN depstrlist.Count; END; (* End of inner WHILE loop for dependencies *)
END; (* End of IF depsValue IS Json.Obj *) RETURN depstrlist.Count;
END; (* End of IF depsValue IS Json.Obj *)
END;
rootObj := rootObj.next; (* Move to the next JSON object *) rootObj := rootObj.next; (* Move to the next JSON object *)
END; (* End of WHILE rootObj # NIL loop *) END; (* End of WHILE rootObj # NIL loop *)
ELSE ELSE