mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[generator] Fix Features stage crash on an empty relation
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
d5ce81b20b
commit
d7f73f4b9b
@@ -51,7 +51,13 @@ std::optional<m2::PointD> FeatureMakerSimple::GetOrigin(OsmElement const & e) co
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CHECK(!e.m_members.empty(), (e.m_id));
|
if (e.m_members.empty())
|
||||||
|
{
|
||||||
|
// Such relations are considered invalid but could be present in OSM data still,
|
||||||
|
// see https://wiki.openstreetmap.org/wiki/Empty_relations
|
||||||
|
LOG(LWARNING, ("Invalid relation with no members", e.m_id));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
for (auto const & m : e.m_members)
|
for (auto const & m : e.m_members)
|
||||||
{
|
{
|
||||||
if (m.m_type == OsmElement::EntityType::Node)
|
if (m.m_type == OsmElement::EntityType::Node)
|
||||||
|
|||||||
@@ -1016,6 +1016,7 @@ void PreprocessElement(OsmElement * p, CalculateOriginFnT const & calcOrg)
|
|||||||
if (value != "province")
|
if (value != "province")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
///@todo(pastk) some invalid relations might be empty so this might fail.
|
||||||
CHECK(calcOrg, ());
|
CHECK(calcOrg, ());
|
||||||
auto const org = calcOrg(p);
|
auto const org = calcOrg(p);
|
||||||
if (org && s_countriesChecker.IsTransformToState(*org))
|
if (org && s_countriesChecker.IsTransformToState(*org))
|
||||||
@@ -1471,6 +1472,7 @@ void GetNameAndType(OsmElement * p, FeatureBuilderParams & params,
|
|||||||
|
|
||||||
static CityBBox s_cityBBox;
|
static CityBBox s_cityBBox;
|
||||||
|
|
||||||
|
///@todo(pastk) some invalid relations might be empty so this might fail.
|
||||||
CHECK(calcOrg, ());
|
CHECK(calcOrg, ());
|
||||||
auto const org = calcOrg(p);
|
auto const org = calcOrg(p);
|
||||||
if (org && s_cityBBox.IsInside(*org))
|
if (org && s_cityBBox.IsInside(*org))
|
||||||
|
|||||||
Reference in New Issue
Block a user