mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
Guard contour map projection against missing eclipse case
RimEclipseContourMapProjection::updateGridInformation() dereferences eclipseCase() unchecked. It is null when the contour map view has no case, e.g. when a grid calculation triggers updateAll3dViews. updateGridInformation() resets the grid and projection and returns when the case or its data is missing. generateResultsIfNecessary() returns when there is no projection, and computeMinMaxValuesAllTimeSteps() handles a missing case. New test RimEclipseContourMapProjection.GenerateResultsWithoutEclipseCase. Call stack: [3] RimEclipseCase::eclipseCaseData() at ResInsight/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp:196 [4] RimEclipseContourMapProjection::updateGridInformation() at ResInsight/ApplicationLibCode/ProjectDataModel/ContourMap/RimEclipseContourMapProjection.cpp:250 [5] RimContourMapProjection::generateResultsIfNecessary(int) at ResInsight/ApplicationLibCode/ProjectDataModel/ContourMap/RimContourMapProjection.cpp:138 [6] RimEclipseContourMapProjection::clearGridMappingAndRedraw() at ResInsight/ApplicationLibCode/ProjectDataModel/ContourMap/RimEclipseContourMapProjection.cpp:167 [7] RimReloadCaseTools::updateAll3dViews(RimEclipseCase*) at ResInsight/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp:157 [8] RimGridCalculation::updateDependentObjects() at ResInsight/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp:762 [9] RicUserDefinedCalculatorUi::calculate() const at ResInsight/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp:178 [10] RicCalculatorWidgetCreator::slotCalculate() at ResInsight/ApplicationLibCode/Commands/RicCalculatorWidgetCreator.cpp:205
This commit is contained in:
1 parent
067c9c8880
commit
f22e96b2f5
4 files changed
+45
-1
No files matched your search
@@ -102,6 +102,7 @@ set(SOURCE_UNITTEST_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowDescribeTools-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowVec3Binding-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDataFilterCollection-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseContourMapProjection-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIntersectionCollection-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDockWindowController-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFilterInViewCollection-Test.cpp
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2026 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "ContourMap/RimContourMapProjection.h"
|
||||
#include "ContourMap/RimEclipseContourMapView.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// A contour map view without an eclipse case must not crash when results are generated.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST( RimEclipseContourMapProjection, GenerateResultsWithoutEclipseCase )
|
||||
{
|
||||
RimEclipseContourMapView view;
|
||||
ASSERT_NE( nullptr, view.contourMapProjection() );
|
||||
|
||||
view.contourMapProjection()->generateResultsIfNecessary( 0 );
|
||||
}
|
||||
Reference in new issue
Block a user