diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicLinkWellPathFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicLinkWellPathFeature.cpp index 4707eb8d5e..587ea35eff 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicLinkWellPathFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicLinkWellPathFeature.cpp @@ -81,7 +81,11 @@ RimWellPathGeometryDef* RicLinkWellPathFeature::wellPathGeometryDef() auto wellPathSelectionItem = RiuWellPathSelectionItem::wellPathSelectionItem(); if ( wellPathSelectionItem && wellPathSelectionItem->m_wellpath ) { - auto modeledWellPath = dynamic_cast( wellPathSelectionItem->m_wellpath ); - return modeledWellPath->geometryDefinition(); + if ( auto modeledWellPath = dynamic_cast( wellPathSelectionItem->m_wellpath ) ) + { + return modeledWellPath->geometryDefinition(); + } } + + return nullptr; }