Skip to content

Commit

Permalink
json: Make it safe to pass null pointers to json_equal().
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Pfaff <[email protected]>
Reviewed-by: Yifeng Sun <[email protected]>
Acked-by: Justin Pettit <[email protected]>
  • Loading branch information
blp committed Feb 6, 2018
1 parent 303566c commit f15a232
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,9 @@ json_equal(const struct json *a, const struct json *b)
{
if (a == b) {
return true;
}

if (a->type != b->type) {
} else if (!a || !b) {
return false;
} else if (a->type != b->type) {
return false;
}

Expand Down

0 comments on commit f15a232

Please sign in to comment.