]> OCCT Git - occt.git/commitdiff
Application Framework - Early-return null NamedShape when TNaming_UsedShapes is missi...
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Fri, 24 Oct 2025 08:11:48 +0000 (09:11 +0100)
committerdpasukhi <dpasukhi@opencascade.com>
Fri, 5 Dec 2025 22:43:17 +0000 (22:43 +0000)
Check Acces.Root().FindAttribute(...) result in TNaming_Tool::NamedShape and return an empty Handle
if the TNaming_UsedShapes attribute is not found to avoid using an uninitialized map.

src/TNaming/TNaming_NamedShape.cxx

index cb9b35283db4c6c4af9dd059dbda9a8bed8b9b34..684fe907c81af3aa0b9e6817738e1209ef47b7db 100644 (file)
@@ -1429,9 +1429,12 @@ TDF_Label TNaming_Tool::Label(const Handle(TNaming_UsedShapes)& Shapes,
 
 Handle(TNaming_NamedShape) TNaming_Tool::NamedShape(const TopoDS_Shape& S, const TDF_Label& Acces)
 {
-  Handle(TNaming_UsedShapes) US;
-  Acces.Root().FindAttribute(TNaming_UsedShapes::GetID(), US);
   Handle(TNaming_NamedShape) NS;
+  Handle(TNaming_UsedShapes) US;
+  if (!Acces.Root().FindAttribute(TNaming_UsedShapes::GetID(), US))
+  {
+    return NS;
+  }
 
   if (!TNaming_Tool::HasLabel(US, S))
   {