#5102 Janitor : Guard null pointer access

This commit is contained in:
Magne Sjaastad
2019-11-27 10:17:31 +01:00
parent ded7be1d73
commit dc2af5e0c8
9 changed files with 13 additions and 3 deletions

View File

@@ -40,6 +40,7 @@ bool RicPasteWellLogPlotFeature::isCommandEnabled()
{
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(
caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return false;
RimWellLogPlotCollection* wellLogPlotCollection = nullptr;
destinationObject->firstAncestorOrThisOfType( wellLogPlotCollection );
@@ -58,6 +59,7 @@ void RicPasteWellLogPlotFeature::onActionTriggered( bool isChecked )
{
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(
caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return;
RimWellLogPlotCollection* wellLogPlotCollection = nullptr;
destinationObject->firstAncestorOrThisOfType( wellLogPlotCollection );