From 6a5f19d5a0c41276bb99c6893ef508fd24a19795 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 9 Jun 2026 10:01:31 +0200 Subject: [PATCH] #14172 Fix crash in 3D well target editor from null parent well geometry Guard against a null wellPathGeometry() when configuring the 3D well target editor for the first target of a lateral. The parent well pointer can be non-null while its geometry is not yet available, which caused a null dereference when copying wellPathPoints(). --- .../RicWellTarget3dEditor.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp index af16230181..c54f08a343 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicWellTarget3dEditor.cpp @@ -125,17 +125,19 @@ void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName ) { if ( auto parentWellPath = wellPath->wellPathTieIn()->parentWell() ) { - auto geo = parentWellPath->wellPathGeometry(); - auto points = geo->wellPathPoints(); - - for ( auto& p : points ) + if ( auto geo = parentWellPath->wellPathGeometry() ) { - p = dispXf->transformToDisplayCoord( p ); - } + auto points = geo->wellPathPoints(); - // For the first target of a lateral, use the coordinates from the parent well as snap-to locations for - // the 3D manipulator sphere - m_manipulator->setPolyline( points ); + for ( auto& p : points ) + { + p = dispXf->transformToDisplayCoord( p ); + } + + // For the first target of a lateral, use the coordinates from the parent well as snap-to locations + // for the 3D manipulator sphere + m_manipulator->setPolyline( points ); + } } } }