diff options
author | Sergey Magidovich <mgsergio@mapswithme.com> | 2016-06-10 12:21:25 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-06-23 19:23:40 +0300 |
commit | 2ab4066e02f5d2f40e227ee37e4608d7caa07416 (patch) | |
tree | 8161d68bdcbe778513014a4dd555295a8b47143e /indexer/osm_editor.cpp | |
parent | fe7e960ce0834b6237e7cc603b58df1557f47a7b (diff) |
Fix crash while loading feature created on deleted mwm.
Diffstat (limited to 'indexer/osm_editor.cpp')
-rw-r--r-- | indexer/osm_editor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index 3de6497b13..5fa071628c 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -131,6 +131,13 @@ bool IsObsolete(editor::XMLFeature const & xml, FeatureID const & fid) return uploadTime != my::INVALID_TIME_STAMP && my::TimeTToSecondsSinceEpoch(uploadTime) < GetMwmCreationTimeByMwmId(fid.m_mwmId); } + +m2::PointD GetSomeFeaturePoint(editor::XMLFeature const & xml) +{ + if (xml.GetType() == XMLFeature::Type::Node) + return xml.GetMercatorCenter(); + return xml.GetGeometry().front(); +} } // namespace namespace osm @@ -197,6 +204,14 @@ void Editor::LoadMapEdits() { XMLFeature const xml(nodeOrWay.node()); + // TODO(mgsergio): A map could be renamed, we'll treat it as deleted. + // The right thing to do is to try to migrate all changes anyway. + if (!mwmId.IsAlive()) + { + LOG(LINFO, ("Mwm", mapName, "was deleted")); + goto SECTION_END; + } + // TODO(mgsergio): Deleted features are not properly handled yet. auto const fid = needMigrateEdits ? editor::MigrateFeatureIndex( @@ -251,6 +266,8 @@ void Editor::LoadMapEdits() } } // for nodes } // for sections + SECTION_END: + ; } // for mwms // Save edits with new indexes and mwm version to avoid another migration on next startup. |