Salome HOME
Updated copyright comment
[modules/shaper.git] / src / Model / Model_AttributeReference.cpp
index 0b2d2869a3ed7f120f5f1449c405a21d598d94d9..cc8dc2f0908ef5ebfadae551a52b9966766abad1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -82,11 +82,13 @@ ObjectPtr Model_AttributeReference::value()
       Handle(TDataStd_AsciiString) anEntry;
       if (myRef->Label().FindAttribute(TDataStd_AsciiString::GetID(), anEntry)) {
         std::shared_ptr<Model_Document> aDR = std::dynamic_pointer_cast<Model_Document>(aRefDoc);
-        TDF_Label aRefLab;
-        TDF_Tool::Label(aDR->objects()->featuresLabel().Data(),
-          anEntry->Get().ToCString(), aRefLab);
-        if (!aRefLab.IsNull()) {
-          return aDR->objects()->object(aRefLab);
+        if (aDR.get() && aDR->objects()) {
+          TDF_Label aRefLab;
+          TDF_Tool::Label(aDR->objects()->featuresLabel().Data(),
+            anEntry->Get().ToCString(), aRefLab);
+          if (!aRefLab.IsNull()) {
+            return aDR->objects()->object(aRefLab);
+          }
         }
       }
     }