mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-21 03:55:00 +00:00
Add null pointer check when testing for bare geometry in GeoJSON
This commit is contained in:
parent
ac67013930
commit
9964784e77
@ -278,7 +278,7 @@ void parse_json(struct serialization_state *sst, json_pull *jp, int layer, std::
|
||||
|
||||
if (is_geometry) {
|
||||
if (j->parent != NULL) {
|
||||
if (j->parent->type == JSON_ARRAY) {
|
||||
if (j->parent->type == JSON_ARRAY && j->parent->parent != NULL) {
|
||||
if (j->parent->parent->type == JSON_HASH) {
|
||||
json_object *geometries = json_hash_get(j->parent->parent, "geometries");
|
||||
if (geometries != NULL) {
|
||||
|
@ -1,3 +1,7 @@
|
||||
{ "type": "LineString", "coordinates": [ [ 2.460937, 46.073230 ], [ 43.242187, 59.9 ] ] }
|
||||
|
||||
{ "something": [ { "type": "LineString", "coordinates": [ [ -1.40625, 28.921631 ], [ 26.71875, 17.978733 ], [ 22.148437, -23.563987 ] ] } ] }
|
||||
|
||||
{ "something": { "type": "LineString", "coordinates": [ [ 1, 2 ], [ 3, 4 ] ] } }
|
||||
|
||||
[ { "type": "LineString", "coordinates": [ [ 5, 6 ], [ 7, 8 ] ] } ]
|
||||
|
@ -3,7 +3,7 @@
|
||||
"center": "22.500000,20.489949,3",
|
||||
"description": "tests/geometry/out/-z3.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"bare\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {} }, { \"id\": \"geometrycollection\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"collection\": \"Boolean\"} }, { \"id\": \"multipoint\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"point\": \"String\"} }, { \"id\": \"onebare\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 4,\"layers\": [{\"layer\": \"bare\",\"count\": 2,\"geometry\": \"LineString\",\"attributeCount\": 0,\"attributes\": []},{\"layer\": \"geometrycollection\",\"count\": 2,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"collection\",\"count\": 1,\"type\": \"boolean\",\"values\": [true]}]},{\"layer\": \"multipoint\",\"count\": 1,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"point\",\"count\": 1,\"type\": \"string\",\"values\": [\"multi\"]}]},{\"layer\": \"onebare\",\"count\": 1,\"geometry\": \"LineString\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"bare\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {} }, { \"id\": \"geometrycollection\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"collection\": \"Boolean\"} }, { \"id\": \"multipoint\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"point\": \"String\"} }, { \"id\": \"onebare\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 4,\"layers\": [{\"layer\": \"bare\",\"count\": 4,\"geometry\": \"LineString\",\"attributeCount\": 0,\"attributes\": []},{\"layer\": \"geometrycollection\",\"count\": 2,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"collection\",\"count\": 1,\"type\": \"boolean\",\"values\": [true]}]},{\"layer\": \"multipoint\",\"count\": 1,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"point\",\"count\": 1,\"type\": \"string\",\"values\": [\"multi\"]}]},{\"layer\": \"onebare\",\"count\": 1,\"geometry\": \"LineString\",\"attributeCount\": 0,\"attributes\": []}]}}",
|
||||
"maxzoom": "3",
|
||||
"minzoom": "0",
|
||||
"name": "tests/geometry/out/-z3.json.check.mbtiles",
|
||||
@ -14,6 +14,10 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "bare", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 2.373047, 46.073231 ], [ 43.154297, 59.933000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.966797, 2.021065 ], [ 2.988281, 4.039618 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 4.921875, 6.053161 ], [ 6.943359, 8.059230 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -1.406250, 28.921631 ], [ 26.718750, 17.978733 ], [ 22.060547, -23.483401 ] ] } }
|
||||
] }
|
||||
,
|
||||
@ -31,6 +35,10 @@
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 0, "y": 1 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "bare", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.966797, 2.021065 ], [ 2.504883, 3.513421 ] ] } }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "multipoint", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "point": "multi" }, "geometry": { "type": "Point", "coordinates": [ -60.468750, -6.970049 ] } }
|
||||
] }
|
||||
@ -40,6 +48,8 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "bare", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 2.416992, 46.073231 ], [ 3.515625, 46.498392 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.966797, 2.021065 ], [ 2.988281, 4.039618 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -1.406250, 28.921631 ], [ 0.000000, 28.420391 ], [ 3.515625, 27.098254 ] ] } }
|
||||
] }
|
||||
,
|
||||
@ -54,6 +64,8 @@
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 1, "y": 1 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "bare", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.966797, 2.021065 ], [ 2.504883, 3.513421 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 25.092773, 3.513421 ], [ 24.741211, 0.000000 ], [ 22.104492, -23.523700 ] ] } }
|
||||
] }
|
||||
,
|
||||
@ -72,6 +84,10 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "bare", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 2.416992, 46.073231 ], [ 43.198242, 59.910976 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.966797, 2.021065 ], [ 2.988281, 4.039618 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 4.965820, 6.009459 ], [ 6.987305, 8.015716 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -1.406250, 28.921631 ], [ 0.000000, 28.420391 ], [ 26.718750, 17.978733 ], [ 24.741211, 0.000000 ], [ 24.345703, -3.513421 ] ] } }
|
||||
] }
|
||||
,
|
||||
@ -100,6 +116,8 @@
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 2, "x": 1, "y": 1 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "bare", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.988770, 2.021065 ], [ 1.757812, 2.767478 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -1.406250, 28.921631 ], [ 0.000000, 28.401065 ], [ 1.757812, 27.741885 ] ] } }
|
||||
] }
|
||||
,
|
||||
@ -122,6 +140,10 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "bare", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 2.438965, 46.073231 ], [ 43.220215, 59.910976 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.988770, 2.021065 ], [ 2.988281, 4.017699 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 4.987793, 6.009459 ], [ 6.987305, 8.015716 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -1.406250, 28.921631 ], [ 0.000000, 28.401065 ], [ 26.718750, 17.978733 ], [ 24.741211, 0.000000 ], [ 24.543457, -1.757537 ] ] } }
|
||||
] }
|
||||
,
|
||||
@ -182,6 +204,10 @@
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 3, "x": 4, "y": 3 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "bare", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.999756, 2.010086 ], [ 2.999268, 4.006740 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 4.998779, 6.009459 ], [ 6.998291, 8.004837 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -0.878906, 28.729130 ], [ 0.000000, 28.401065 ], [ 26.718750, 17.978733 ], [ 24.741211, 0.000000 ], [ 24.642334, -0.878872 ] ] } }
|
||||
] }
|
||||
] }
|
||||
|
Loading…
Reference in New Issue
Block a user