]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2690: Check folders attributes on delete of the folder
authorvsv <vsv@opencascade.com>
Mon, 29 Oct 2018 09:14:02 +0000 (12:14 +0300)
committermpv <mpv@opencascade.com>
Mon, 19 Nov 2018 08:45:52 +0000 (11:45 +0300)
src/PartSet/PartSet_Tools.cpp

index 020c47a27c9ef3b1e01e5ec8f2f90ebc2bd45529..0d91654e57e91d2ebc2bfbff1bdc5115b4a96510 100755 (executable)
@@ -757,6 +757,9 @@ ResultPtr PartSet_Tools::createFixedByExternalCenter(
 void PartSet_Tools::getFirstAndLastIndexInFolder(const ObjectPtr& theFolder,
   int& theFirst, int& theLast)
 {
+  theFirst = -1;
+  theLast = -1;
+
   DocumentPtr aDoc = theFolder->document();
   FolderPtr aFolder = std::dynamic_pointer_cast<ModelAPI_Folder>(theFolder);
   if (!aFolder.get())
@@ -764,18 +767,19 @@ void PartSet_Tools::getFirstAndLastIndexInFolder(const ObjectPtr& theFolder,
 
   AttributeReferencePtr aFirstFeatAttr =
     aFolder->data()->reference(ModelAPI_Folder::FIRST_FEATURE_ID());
+  if (!aFirstFeatAttr.get())
+    return;
   FeaturePtr aFirstFeatureInFolder = ModelAPI_Feature::feature(aFirstFeatAttr->value());
-  if (!aFirstFeatureInFolder.get()) {
-    theFirst = -1;
+  if (!aFirstFeatureInFolder.get())
     return;
-  }
+
   AttributeReferencePtr aLastFeatAttr =
     aFolder->data()->reference(ModelAPI_Folder::LAST_FEATURE_ID());
+  if (!aLastFeatAttr.get())
+    return;
   FeaturePtr aLastFeatureInFolder = ModelAPI_Feature::feature(aLastFeatAttr->value());
-  if (!aLastFeatureInFolder.get()) {
-    theLast = -1;
+  if (!aLastFeatureInFolder.get())
     return;
-  }
 
   theFirst = aDoc->index(aFirstFeatureInFolder);
   theLast = aDoc->index(aLastFeatureInFolder);