From: Christophe Bourcier Date: Wed, 6 Sep 2023 14:59:24 +0000 (+0200) Subject: To fix salome test test.hdfs. Prevent a crash in case aDoc does not exist X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b448b41d68ca68bfd8cd4d783f47f6f5c05b3c2c;p=modules%2Fshaper.git To fix salome test test.hdfs. Prevent a crash in case aDoc does not exist --- diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index da130c0ac..9afabf394 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -1429,6 +1429,12 @@ void setDisplaying(ResultPartPtr thePart, bool theDisplayFromScript) isDoingDisplay = true; DocumentPtr aDoc = thePart->partDoc(); + + if (!aDoc) { + // Prevent a crash in case aDoc does not exist + return; + } + int aConstructionSize = aDoc->size(ModelAPI_ResultConstruction::group()); int aGroupSize = aDoc->size(ModelAPI_ResultGroup::group()); int aFieldSize = aDoc->size(ModelAPI_ResultField::group());