#14878: Guard against deleted formations collection and missing geometry

This commit is contained in:
Magne Sjaastad committed 2026-10-08 12:44:14 +02:00
1 parent 6c42ba5ae0
commit 029759f548
3 files changed
+12 -2

No files matched your search

@@ -2618,9 +2618,14 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
auto formationLevel = static_cast<RigWellPathFormations::FormationLevel>( m_formationSettings->formationLevel() );
double rkbDiff = 0.0;
if ( plot->depthType() == RiaDefines::DepthType::TRUE_VERTICAL_DEPTH_RKB && m_formationSettings->wellPathForSourceWellPath() )
if ( plot->depthType() == RiaDefines::DepthType::TRUE_VERTICAL_DEPTH_RKB )
{
rkbDiff = m_formationSettings->wellPathForSourceWellPath()->wellPathGeometry()->rkbDiff();
// Picks-only wells have no trajectory
auto sourceWellPath = m_formationSettings->wellPathForSourceWellPath();
if ( sourceWellPath && sourceWellPath->wellPathGeometry() )
{
rkbDiff = sourceWellPath->wellPathGeometry()->rkbDiff();
}
}
// Fluid contacts are single-depth picks (no zone thickness); keep these as simple pick lines.
@@ -582,6 +582,8 @@ void RimWellPath::initAfterRead()
{
if ( auto oilField = RimProject::current()->activeOilField() )
{
if ( !oilField->wellFormationsCollection() ) oilField->wellFormationsCollection = new RimWellFormationsCollection();
auto* file = oilField->wellFormationsCollection->findOrCreate( m_wellPathFormationFilePath_OBSOLETE().path() );
setWellFormationsFile( file, m_formationKeyInFile() );
}
@@ -533,6 +533,9 @@ void RimWellPathCollection::addWellPathFormations( const QStringList& filePaths
outputMessage += "-----------------------------------------------\n";
outputMessage += "Well Name \tDetected Well Path \tCount\n";
// The collection is deletable from the project tree
if ( !oilField->wellFormationsCollection() ) oilField->wellFormationsCollection = new RimWellFormationsCollection();
bool fileReadSuccess = false;
for ( const QString& filePath : filePaths )