diff --git a/openlr/openlr_model_xml.cpp b/openlr/openlr_model_xml.cpp index bc5b285a8f..9570becffb 100644 --- a/openlr/openlr_model_xml.cpp +++ b/openlr/openlr_model_xml.cpp @@ -53,6 +53,13 @@ pugi::xml_node GetLinearLocationReference(pugi::xml_node const & node) return node.select_node(".//olr:locationReference/olr:optionLinearLocationReference").node(); } +bool NoLocationReferenceButCoordinates(pugi::xml_node const & node) +{ + if (node.select_node(".//olr:locationReference").node()) + return false; + return node.select_node("coordinates").node(); +} + // This helper is used do deal with xml nodes of the form // // integer @@ -253,8 +260,16 @@ bool ParseOpenlr(pugi::xml_document const & document, vector & se for (auto const segmentXpathNode : document.select_nodes("//reportSegments")) { LinearSegment segment; + if (NoLocationReferenceButCoordinates(segmentXpathNode.node())) + { + LOG(LWARNING, ("A segment with instead of " + "encounted, skipping...")); + continue; + } + if (!SegmentFromXML(segmentXpathNode.node(), segment)) return false; + segments.push_back(segment); } return true;