From 93b5c39387977cc3d6430e507afa1542727fb29d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 30 Jun 2021 12:37:57 +0200 Subject: [PATCH] Janitor : Guard nullpointer access --- .../Commands/WellPathCommands/RicLinkWellPathFeature.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; }