From 8212e5136ee85d0d1eb5907e676d3a854acac308 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Fri, 9 Oct 2020 10:52:15 +0200 Subject: [PATCH] fix bug abort when viewId is 0 on displaying images (import images) --- src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx | 2 +- src/HYDROGUI/HYDROGUI_Module.cxx | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) 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 ); } } -- 2.39.2