protect against missing tst in JSON

This commit is contained in:
Jan-Piet Mens
2016-02-24 07:52:19 +01:00
parent 2ac53a87f9
commit 0bf8cbaf1e
+5
View File
@@ -35,6 +35,11 @@ static double cmp(JsonNode * a, JsonNode * b)
JsonNode *tb = json_find_member(b, "tst");
//printf("a=%lf, b=%lf\n", ta->number_, tb->number_);
/* user may have chosen fields without tst */
if (!ta || !tb)
return (0.0);
return ta->number_ - tb->number_;
}