summaryrefslogtreecommitdiff
path: root/tagstats/tagstats_handler.hpp
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2013-10-07 14:37:45 +0200
committerJochen Topf <jochen@topf.org>2013-10-07 14:37:45 +0200
commitf84a44f998063fdf457f91e950940112bbc1bc6e (patch)
treebd58661f2c7f3d799e1c48d778c91968f03e3d20 /tagstats/tagstats_handler.hpp
parentd7330666d1eb8ceb2a362d2434d46b777cbbd0bf (diff)
downloadtaginfo-f84a44f998063fdf457f91e950940112bbc1bc6e.tar
taginfo-f84a44f998063fdf457f91e950940112bbc1bc6e.tar.gz
Fix a bug with nodes outside bbox
If there are nodes with locations outside the bounding box we are interested in in the input osm file and we are generating the geodistribution for ways images, tagstats could segfault. In this case the node location wasn't stored in the m_storage, so when reading the it back, either you get an unintialized value or a segfault. (This also depends on the type of storage used.) Thanks to @lonvia for help debugging this. The solution is to store "MAXINT" as a marker and make sure it doesn't end up in the GeoDistribution.
Diffstat (limited to 'tagstats/tagstats_handler.hpp')
-rw-r--r--tagstats/tagstats_handler.hpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/tagstats/tagstats_handler.hpp b/tagstats/tagstats_handler.hpp
index 4049083..d3ea136 100644
--- a/tagstats/tagstats_handler.hpp
+++ b/tagstats/tagstats_handler.hpp
@@ -412,11 +412,7 @@ class TagStatsHandler : public Osmium::Handler::Base {
stat->update(it->value(), object, m_string_store);
if (object.type() == NODE) {
- try {
- stat->distribution.add_coordinate(m_map_to_int(static_cast<const Osmium::OSM::Node&>(object).position()));
- } catch (std::range_error) {
- // ignore
- }
+ stat->distribution.add_coordinate(m_map_to_int(static_cast<const Osmium::OSM::Node&>(object).position()));
}
#ifdef TAGSTATS_GEODISTRIBUTION_FOR_WAYS
else if (object.type() == WAY) {
@@ -479,11 +475,7 @@ public:
statistics_handler.node(node);
collect_tag_stats(*node);
#ifdef TAGSTATS_GEODISTRIBUTION_FOR_WAYS
- try {
- m_storage.set(node->id(), m_map_to_int(node->position()));
- } catch (std::range_error) {
- // ignore
- }
+ m_storage.set(node->id(), m_map_to_int(node->position()));
#endif
}