#14121 Well Path: prevent crash when exporting completions for a non-existing well path

When a project references an RMS well path file that no longer exists, the well path geometry is null. The MSW completion export validated the eclipse case, well path, and MSW parameters but not the geometry, so generateCellSegments asserted and crashed when triggering Export Completion Data for Visible Well Paths.

Guard the single MSW export dispatcher extractSingleWellMswData with a well path geometry null check that returns an error, protecting all export callers. Harden generateCellSegments to return empty instead of asserting on null geometry.

Also log a warning on the interactive well path import path when a file cannot be read, matching the existing project-load behavior.

Fixes #14121.
This commit is contained in:
Kristian Bendiksen authored and Magne Sjaastad committed 2026-06-08 08:46:40 +02:00
1 parent b20fcd5138
commit 253d57f1a5
2 files changed
+11 -2

No files matched your search

@@ -72,6 +72,11 @@ std::expected<RigMswTableData, std::string>
CompletionType completionType,
const std::optional<QDateTime>& exportDate )
{
if ( !wellPath || !wellPath->wellPathGeometry() )
{
return std::unexpected( "Well path has no geometry; the well path file may be missing or failed to load." );
}
// Data processing for MSW has improved. Currently, there exist two code paths for extracting MSW data. The preference for using the
// legacy code path is controlled by the "Use Improved MSW Data Structures" preference (General tab, Other group).
bool useLegacy = !RiaPreferences::current()->useImprovedMswDataStructures();
@@ -699,7 +704,7 @@ std::vector<WellPathCellIntersectionInfo> RicWellPathExportMswTableData::generat
const RimWellPath* wellPath )
{
auto wellPathGeometry = wellPath->wellPathGeometry();
CVF_ASSERT( wellPathGeometry );
if ( !wellPathGeometry ) return {};
const std::vector<cvf::Vec3d>& coords = wellPathGeometry->uniqueWellPathPoints();
const std::vector<double>& mds = wellPathGeometry->uniqueMeasuredDepths();
@@ -412,7 +412,11 @@ std::vector<RimWellPath*> RimWellPathCollection::readAndAddWellPaths( std::vecto
std::vector<RimWellPath*> addedWellPaths;
for ( RimFileWellPath* wellPath : wellPathArray )
{
wellPath->readWellPathFile( nullptr, m_wellPathImporter.get(), true );
QString errorMessage;
if ( !wellPath->readWellPathFile( &errorMessage, m_wellPathImporter.get(), true ) )
{
RiaLogging::warning( errorMessage.toStdString() );
}
progress.setProgressDescription( QString( "Reading file %1" ).arg( wellPath->name() ) );