From b448b41d68ca68bfd8cd4d783f47f6f5c05b3c2c Mon Sep 17 00:00:00 2001 From: Christophe Bourcier Date: Wed, 6 Sep 2023 16:59:24 +0200 Subject: [PATCH] To fix salome test test.hdfs. Prevent a crash in case aDoc does not exist --- src/ModuleBase/ModuleBase_Tools.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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()); -- 2.39.2