Skip to content

Commit

Permalink
Fixes GH#4: assertions in json_api_mapper.c (hinted by Koop Mast)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwindolf committed Dec 14, 2013
1 parent 3e0aa67 commit 3b16768
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/fl_sources/json_api_mapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ json_api_get_string (JsonNode *parent, const gchar *mapping)
JsonNode *node;
const gchar *field;

if (!node || !mapping)
return;
if (!parent || !mapping)
return NULL;

node = json_api_get_node (parent, mapping);
if (!node)
return NULL;

field = strrchr (mapping, '/');
if (!field)
field = mapping;
Expand All @@ -73,10 +76,13 @@ json_api_get_int (JsonNode *parent, const gchar *mapping)
JsonNode *node;
const gchar *field;

if (!node || !mapping)
return;
if (!parent || !mapping)
return 0;

node = json_api_get_node (parent, mapping);
if (!node)
return 0;

field = strrchr (mapping, '/');
if (!field)
field = mapping;
Expand All @@ -92,10 +98,13 @@ json_api_get_bool (JsonNode *parent, const gchar *mapping)
JsonNode *node;
const gchar *field;

if (!node || !mapping)
return;
if (!parent || !mapping)
return FALSE;

node = json_api_get_node (parent, mapping);
if (!node)
return FALSE;

field = strrchr (mapping, '/');
if (!field)
field = mapping;
Expand Down

0 comments on commit 3b16768

Please sign in to comment.