From d9de3eee6ef9fd59d1278a1093316a1b62d2c8e3 Mon Sep 17 00:00:00 2001 From: Viktor Govako Date: Mon, 7 Mar 2022 22:34:46 +0100 Subject: [PATCH] [generator] Fixed possible bug in MaxspeedsMwmCollector. Signed-off-by: Viktor Govako --- generator/maxspeeds_builder.cpp | 6 ++++++ routing/geometry.cpp | 1 + 2 files changed, 7 insertions(+) diff --git a/generator/maxspeeds_builder.cpp b/generator/maxspeeds_builder.cpp index d9c50da464..4bf9769f01 100644 --- a/generator/maxspeeds_builder.cpp +++ b/generator/maxspeeds_builder.cpp @@ -165,6 +165,12 @@ public: auto const osmID = GetOsmID(fid).GetSerialId(); + if (ft.GetGeomType() != GeomType::Line) + { + LOG(LWARNING, ("Non linear road with speed for way", osmID)); + return; + } + #define LOG_MAX_SPEED(msg) if (false) LOG(LINFO, msg) LOG_MAX_SPEED(("Start osmid =", osmID)); diff --git a/routing/geometry.cpp b/routing/geometry.cpp index 7cb8aa9e59..acfd5d5ee0 100644 --- a/routing/geometry.cpp +++ b/routing/geometry.cpp @@ -157,6 +157,7 @@ void RoadGeometry::Load(VehicleModelInterface const & vehicleModel, FeatureType geometry::Altitudes const * altitudes, RoadAttrsGetter & attrs) { size_t const count = feature.GetPointsCount(); + CHECK_GREATER(count, 1, ()); CHECK(altitudes == nullptr || altitudes->size() == count, ()); feature::TypesHolder types(feature);