Only insert a new tilestats record if there isn't already one

This commit is contained in:
Eric Fischer 2017-07-18 17:28:30 -07:00
parent b3078ddeec
commit 9078098511

View File

@ -431,10 +431,14 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje
if (tas.type >= 0) {
auto fk = layermap->find(layername);
fk->second.file_keys.insert(std::pair<std::string, type_and_string_stats>(tas.string, type_and_string_stats()));
auto fka = fk->second.file_keys.find(tas.string);
if (fka == fk->second.file_keys.end()) {
fk->second.file_keys.insert(std::pair<std::string, type_and_string_stats>(tas.string, type_and_string_stats()));
fka = fk->second.file_keys.find(tas.string);
}
if (track) {
auto fka = fk->second.file_keys.find(tas.string);
if (fka == fk->second.file_keys.end()) {
fprintf(stderr, "Can't happen (tilestats)\n");
exit(EXIT_FAILURE);