diff --git a/indexer/map_object.cpp b/indexer/map_object.cpp index c9c59f0d73..e9e26db88e 100644 --- a/indexer/map_object.cpp +++ b/indexer/map_object.cpp @@ -73,7 +73,16 @@ void MapObject::SetFromFeatureType(FeatureType & ft) { m_mercator = feature::GetCenter(ft); m_name = ft.GetNames(); + + Classificator const & cl = classif(); m_types = feature::TypesHolder(ft); + m_types.RemoveIf([&cl](uint32_t t) + { + return !cl.IsTypeValid(t); + }); + // Actually, we can't select object on map with invalid (non-drawable type). + ASSERT(!m_types.Empty(), ()); + m_metadata = ft.GetMetadata(); m_houseNumber = ft.GetHouseNumber(); m_roadNumber = ft.GetRoadNumber(); diff --git a/indexer/types_mapping.cpp b/indexer/types_mapping.cpp index 81a1b313fa..ef3ccae05a 100644 --- a/indexer/types_mapping.cpp +++ b/indexer/types_mapping.cpp @@ -60,6 +60,8 @@ void IndexAndTypeMapping::Add(uint32_t ind, uint32_t type, bool isMainTypeDescri uint32_t IndexAndTypeMapping::GetIndex(uint32_t t) const { Map::const_iterator i = m_map.find(t); - CHECK ( i != m_map.end(), (t, classif().GetFullObjectName(t)) ); + /// @todo Should review each call of Classificator::GetIndexForType (see also IsTypeValid), + /// because this situation is possible for deleted dummy types in old maps data. + CHECK(i != m_map.end(), (t, classif().GetFullObjectName(t))); return i->second; } diff --git a/map/bookmark_helpers.cpp b/map/bookmark_helpers.cpp index 789962af5d..3c227e7b66 100644 --- a/map/bookmark_helpers.cpp +++ b/map/bookmark_helpers.cpp @@ -439,9 +439,12 @@ void SaveFeatureTypes(feature::TypesHolder const & types, kml::BookmarkData & bm bmData.m_featureTypes.reserve(copy.Size()); for (auto it = copy.begin(); it != copy.end(); ++it) { - bmData.m_featureTypes.push_back(c.GetIndexForType(*it)); - if (bmData.m_icon == kml::BookmarkIcon::None) - bmData.m_icon = GetBookmarkIconByFeatureType(*it); + if (c.IsTypeValid(*it)) + { + bmData.m_featureTypes.push_back(c.GetIndexForType(*it)); + if (bmData.m_icon == kml::BookmarkIcon::None) + bmData.m_icon = GetBookmarkIconByFeatureType(*it); + } } }