mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-24 22:27:55 -05:00
Guard missing eclipse case data in viewer context menu
Avoid null dereference of eclipseCase()/eclipseCaseData()/mainGrid() when building the IJK intersection context menu entries. Call stack: RimEclipseCase::eclipseCaseData() at RimEclipseCase.cpp:197 RiuViewerCommands::displayContextMenu(QMouseEvent*) at RiuViewerCommands.cpp:443
This commit is contained in:
1 parent
cb60a8b9ae
commit
6d8ee8d685
1 file changed
+3
-2
@@ -456,7 +456,8 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
|
||||
menuBuilder << "RicIntersectionBoxYSliceFeature";
|
||||
menuBuilder << "RicIntersectionBoxZSliceFeature";
|
||||
|
||||
if ( auto eclipseView = dynamic_cast<RimEclipseView*>( mainOrComparisonView ) )
|
||||
if ( auto eclipseView = dynamic_cast<RimEclipseView*>( mainOrComparisonView );
|
||||
eclipseView && eclipseView->eclipseCase() && eclipseView->eclipseCase()->eclipseCaseData() )
|
||||
{
|
||||
// I/J/K intersections follow the main grid, so map the picked cell to the main grid
|
||||
const RigGridBase* grid = eclipseView->eclipseCase()->eclipseCaseData()->grid( m_currentGridIdx );
|
||||
@@ -465,7 +466,7 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
|
||||
size_t mainGridCellIndex = grid->cell( m_currentCellIndex ).mainGridCellIndex();
|
||||
|
||||
size_t i, j, k;
|
||||
if ( eclipseView->mainGrid()->ijkFromCellIndex( mainGridCellIndex, &i, &j, &k ) )
|
||||
if ( eclipseView->mainGrid() && eclipseView->mainGrid()->ijkFromCellIndex( mainGridCellIndex, &i, &j, &k ) )
|
||||
{
|
||||
QVariantList iIntersectionList = { 0, static_cast<int>( i ) };
|
||||
QVariantList jIntersectionList = { 1, static_cast<int>( j ) };
|
||||
|
||||
Reference in new issue
Block a user