Skip to content

Commit

Permalink
Nullptr check added on subkey
Browse files Browse the repository at this point in the history
  • Loading branch information
AbrilRBS committed Jul 11, 2016
1 parent a85a086 commit 383c8e9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mp/src/game/shared/momentum/util/jsontokv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ void CJsonToKeyValues::MapNode(JsonNode *node, KeyValues *kv)
// If what we're going to parse is an object, then we need to add it as a subkey.
if (i->value.getTag() == JSON_OBJECT || i->value.getTag() == JSON_ARRAY)
{
kv->AddSubKey(MapNode(i));
KeyValues *pSub = MapNode(i);
if (pSub)
{
kv->AddSubKey(pSub);
}
}
else //Otherwise (string, numbers, booleans) we just add them as an entry of the current key
else // Otherwise (string, numbers, booleans) we just add them as an entry of the current key
{
MapNode(i, kv);
}
Expand All @@ -57,7 +61,7 @@ KeyValues *CJsonToKeyValues::MapNode(JsonNode *node)

// @Ruben: When node->key is null on the json, key is not nullptr, but 0xffeeffee.
// MOM_TODO: Is it always that adress? If not, when / how does it change?

// Parent keyvalue.
KeyValues *pNodeValues =
new KeyValues((node->key == nullptr || POINTER_TO_INT(node->key) == 0xffeeffee) ? nullptr : node->key);
Expand Down

0 comments on commit 383c8e9

Please sign in to comment.