mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-24 10:44:51 +00:00
Fix crash when encoding boolean properties.
This commit is contained in:
parent
ed2f968b4e
commit
d64328ac35
@ -544,7 +544,7 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
|||||||
m++;
|
m++;
|
||||||
} else if (properties->values[i] != NULL && (properties->values[i]->type == JSON_TRUE || properties->values[i]->type == JSON_FALSE)) {
|
} else if (properties->values[i] != NULL && (properties->values[i]->type == JSON_TRUE || properties->values[i]->type == JSON_FALSE)) {
|
||||||
metatype[m] = VT_BOOLEAN;
|
metatype[m] = VT_BOOLEAN;
|
||||||
metaval[m] = properties->values[i]->string;
|
metaval[m] = properties->values[i]->type == JSON_TRUE ? "true" : "false";
|
||||||
m++;
|
m++;
|
||||||
} else if (properties->values[i] != NULL && (properties->values[i]->type == JSON_NULL)) {
|
} else if (properties->values[i] != NULL && (properties->values[i]->type == JSON_NULL)) {
|
||||||
;
|
;
|
||||||
|
@ -193,6 +193,8 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, char **layername,
|
|||||||
|
|
||||||
if (pv->type == VT_NUMBER) {
|
if (pv->type == VT_NUMBER) {
|
||||||
aprintf(&buf, "\": \"Number\"");
|
aprintf(&buf, "\": \"Number\"");
|
||||||
|
} else if (pv->type == VT_BOOLEAN) {
|
||||||
|
aprintf(&buf, "\": \"Boolean\"");
|
||||||
} else {
|
} else {
|
||||||
aprintf(&buf, "\": \"String\"");
|
aprintf(&buf, "\": \"String\"");
|
||||||
}
|
}
|
||||||
|
2
tile.cc
2
tile.cc
@ -261,6 +261,8 @@ mapnik::vector::tile create_tile(char **layernames, int line_detail, std::vector
|
|||||||
|
|
||||||
if (pv->type == VT_NUMBER) {
|
if (pv->type == VT_NUMBER) {
|
||||||
tv->set_double_value(atof(pv->s));
|
tv->set_double_value(atof(pv->s));
|
||||||
|
} else if (pv->type == VT_BOOLEAN) {
|
||||||
|
tv->set_bool_value(pv->s[0] == 't');
|
||||||
} else {
|
} else {
|
||||||
tv->set_string_value(pv->s);
|
tv->set_string_value(pv->s);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user