From 262fbf26f0e74cd399eaf305c62629ecaad39bd1 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 19 Jun 2018 13:10:58 -0700 Subject: [PATCH] Fix missing null pointer check --- geojson.cpp | 2 +- tests/dateline/in.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/geojson.cpp b/geojson.cpp index 514ecbee..bf106adb 100644 --- a/geojson.cpp +++ b/geojson.cpp @@ -221,7 +221,7 @@ void check_crs(json_object *j, const char *reading) { json_object *properties = json_hash_get(crs, "properties"); if (properties != NULL) { json_object *name = json_hash_get(properties, "name"); - if (name->type == JSON_STRING) { + if (name != NULL && name->type == JSON_STRING) { if (strcmp(name->string, projection->alias) != 0) { if (!quiet) { fprintf(stderr, "%s: Warning: GeoJSON specified projection \"%s\", not the expected \"%s\".\n", reading, name->string, projection->alias); diff --git a/tests/dateline/in.json b/tests/dateline/in.json index b85ab155..5237282a 100644 --- a/tests/dateline/in.json +++ b/tests/dateline/in.json @@ -1,4 +1,6 @@ -{"type":"FeatureCollection","features":[ +{"type":"FeatureCollection", +"crs": { "type": "name", "properties": { } }, +"features":[ {"type":"Feature","properties":{ "boolean": true, "otherboolean": false,