#13876 WellPathGeometry: Return default values instead of assert and crash

This commit is contained in:
Magne Sjaastad
2026-04-16 16:43:36 +02:00
parent d119044854
commit d37e50b55b
2 changed files with 4 additions and 0 deletions
@@ -344,6 +344,7 @@ std::expected<caf::PdmObjectHandle*, QString> RimcWellPath_extractWellPathProper
std::vector<double> mdValues;
auto wellPathGeom = wellPath->wellPathGeometry();
if ( !wellPathGeom ) return std::unexpected( QString( "Well path has no geometry" ) );
double mdStepSize = m_resamplingInterval();
CAF_ASSERT( mdStepSize > 0.0 );
@@ -77,6 +77,9 @@ void RigWellPathGeometryExporter::computeWellPathDataForExport( const RigWellPat
std::vector<double>& tvdValues,
std::vector<double>& mdValues )
{
if ( wellPathGeom.measuredDepths().empty() ) return;
if ( mdStepSize <= 0.0 ) return;
double currMd = wellPathGeom.measuredDepths().front() - mdStepSize;
// Safety check to avoid "infinite" loop: max MD for a well path cannot be more than 100 km
// This could happen in certain corner cases for "weird" input, causing massive memory usage