diff --git a/src/mbgl/renderer/buckets/line_bucket.cpp b/src/mbgl/renderer/buckets/line_bucket.cpp index f8c0198a7..ccfbdba82 100644 --- a/src/mbgl/renderer/buckets/line_bucket.cpp +++ b/src/mbgl/renderer/buckets/line_bucket.cpp @@ -86,7 +86,19 @@ void LineBucket::addGeometry(const GeometryCoordinates& coordinates, }(); // Ignore invalid geometry. - if (len < (options.type == FeatureType::Polygon ? 3 : 2)) { + const std::size_t minLen = (options.type == FeatureType::Polygon ? 3 : 2); + if (len < minLen) { + // Warn once, but only if the source geometry is invalid, not if de-duplication made it invalid. + // This happens, e.g., when attempting to use a GeoJSON `MultiPoint` + // or `MLNPointCollectionFeature` as the source for a line layer. + // Unfortunately, we cannot show the layer or source name from here. + if (coordinates.size() < minLen) { + static bool warned = false; // not thread-safe, there's a small chance of warning more than once + if (!warned) { + warned = true; + Log::Warning(Event::General, "Invalid geometry in line layer"); + } + } return; }