From 602a429a68c3a070fc9e4b71879790095f57b32a Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sun, 16 Feb 2025 17:46:52 +0300 Subject: [PATCH] Fix UB when pathgrid geometry is generated and all pathgrid edges are invalid --- components/sceneutil/pathgridutil.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/sceneutil/pathgridutil.cpp b/components/sceneutil/pathgridutil.cpp index b4de250e77..121ef068d8 100644 --- a/components/sceneutil/pathgridutil.cpp +++ b/components/sceneutil/pathgridutil.cpp @@ -126,9 +126,9 @@ namespace SceneUtil gridGeometry->setVertexArray(vertices); gridGeometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX); - if (pointIndexCount) + if (!pointIndices->empty()) gridGeometry->addPrimitiveSet(pointIndices); - if (edgeIndexCount) + if (!lineIndices->empty()) gridGeometry->addPrimitiveSet(lineIndices); gridGeometry->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); }