#11909 Add null pointer guards when detecting unit system

This commit is contained in:
Magne Sjaastad 2024-11-21 12:01:46 +01:00
parent 8da0690096
commit 065528ffba

View File

@ -808,6 +808,8 @@ void RimWellPathCollection::sortWellsByName()
//--------------------------------------------------------------------------------------------------
caf::AppEnum<RiaDefines::EclipseUnitSystem> RimWellPathCollection::findUnitSystemForWellPath( const RimWellPath* wellPath )
{
if ( !wellPath || !wellPath->wellPathGeometry() ) return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
RimProject* project = RimProject::current();
if ( project->activeOilField()->analysisModels->cases.empty() )
{
@ -815,6 +817,11 @@ caf::AppEnum<RiaDefines::EclipseUnitSystem> RimWellPathCollection::findUnitSyste
}
const RigEclipseCaseData* eclipseCaseData = project->activeOilField()->analysisModels->cases()[0]->eclipseCaseData();
if ( !eclipseCaseData || !eclipseCaseData->mainGrid() )
{
return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
}
cvf::BoundingBox caseBoundingBox = eclipseCaseData->mainGrid()->boundingBox();
cvf::BoundingBox wellPathBoundingBox;
for ( const auto& wellPathPoint : wellPath->wellPathGeometry()->wellPathPoints() )