From: Paul RASCLE Date: Fri, 9 Oct 2020 08:52:15 +0000 (+0200) Subject: fix bug abort when viewId is 0 on displaying images (import images) X-Git-Tag: SH_V2_2_0~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8212e5136ee85d0d1eb5907e676d3a854acac308;p=modules%2Fhydro.git fix bug abort when viewId is 0 on displaying images (import images) --- diff --git a/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx b/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx index 2b17f3e8..bd495e2b 100644 --- a/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx +++ b/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx @@ -68,7 +68,7 @@ void HYDROGUI_LandCoverColoringOp::startOperation() if ( myId == LandCoverScalarMapModeOnId ) { aTable = Handle(HYDROData_StricklerTable)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) ); - if ( !aTable.IsNull() ) { + if ( !aTable.IsNull() && aViewId) { aModule->setLandCoverColoringTable( aViewId, aTable ); } } else if ( myId == LandCoverScalarMapModeOffId ) { diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 3a64a596..df571a98 100755 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -1321,12 +1321,16 @@ void HYDROGUI_Module::setObjectVisible( const size_t theViewId, DEBTRACE("anEntry: " << anEntry.toStdString()); if (myObjectStateMap.find(theViewId) == myObjectStateMap.end()) { - DEBTRACE("theViewId is not a valid key for myObjectStateMap, created"); + DEBTRACE("theViewId is not a valid key for myObjectStateMap"); } - Entry2ObjectStateMap& aEntry2ObjectStateMap = myObjectStateMap[ theViewId ]; // created OK if it does not exist + if (theViewId) + { + Entry2ObjectStateMap& aEntry2ObjectStateMap = myObjectStateMap[ theViewId ]; // created OK if it does not exist + DEBTRACE("myObjectStateMap key created"); - ObjectState& anObjectState = aEntry2ObjectStateMap[ anEntry ]; - anObjectState.Visibility = theState; + ObjectState& anObjectState = aEntry2ObjectStateMap[ anEntry ]; + anObjectState.Visibility = theState; + } HYDROGUI_DataObject* hydroObject = getDataModel()->getDataObject( theObject ); if ( hydroObject ) @@ -2204,7 +2208,7 @@ Handle(HYDROData_StricklerTable) HYDROGUI_Module::getLandCoverColoringTable( con void HYDROGUI_Module::setLandCoverColoringTable( const size_t theViewId, const Handle(HYDROData_StricklerTable)& theTable ) { - if ( !theTable.IsNull() ) { + if ( !theTable.IsNull() && theViewId ) { myLandCoverColoringMap.insert( theViewId, theTable ); } }