From 9078098511bba20b3355084361197f78131a6313 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 18 Jul 2017 17:28:30 -0700 Subject: [PATCH] Only insert a new tilestats record if there isn't already one --- geojson.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/geojson.cpp b/geojson.cpp index 7aae06a..1dbea6a 100644 --- a/geojson.cpp +++ b/geojson.cpp @@ -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(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(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);