]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for python dump checker.
authormpv <mpv@opencascade.com>
Sat, 29 Dec 2018 08:49:16 +0000 (11:49 +0300)
committermpv <mpv@opencascade.com>
Sat, 29 Dec 2018 08:49:16 +0000 (11:49 +0300)
If selection references to removed object, it has null context, but after dump/load it is not-initialized.

src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp

index f0d4deb48d9b2f427daa53e5b842b01ac79a8bf5..b1feda56784e6b549eb84609f6f5a5c316689d5d 100644 (file)
@@ -225,7 +225,10 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) {
   } else if (aType == ModelAPI_AttributeSelection::typeId()) {
     AttributeSelectionPtr anAttr =
       std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttr);
-    aResult<<anAttr->namingName();
+    if (anAttr->context().get())
+      aResult<<anAttr->namingName();
+    else
+      aResult<<"__notinitialized__";
   } else if (aType == ModelAPI_AttributeSelectionList::typeId()) {
     AttributeSelectionListPtr anAttr =
       std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttr);