Merge pull request #5103 from OPM/guard-null-pointer-access

Janitor : Guard null pointer access
This commit is contained in:
Magne Sjaastad 2019-11-27 15:52:27 +01:00 committed by GitHub
commit a3691d0dd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 3 deletions

View File

@ -54,8 +54,7 @@ bool RicPasteAsciiDataToSummaryPlotFeature::isCommandEnabled()
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(
caf::SelectionManager::instance()->selectedItem() );
RimSummaryPlot* summaryPlot = nullptr;
destinationObject->firstAncestorOrThisOfType( summaryPlot );
if ( !destinationObject ) return false;
RimSummaryPlotCollection* summaryPlotCollection = nullptr;
destinationObject->firstAncestorOrThisOfType( summaryPlotCollection );

View File

@ -67,6 +67,7 @@ RimEnsembleCurveSet*
bool RicPasteEnsembleCurveSetFeature::isCommandEnabled()
{
caf::PdmObject* destinationObject = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return false;
RimSummaryPlot* plot = nullptr;
RimEnsembleCurveSetCollection* coll = nullptr;

View File

@ -80,6 +80,7 @@ void RicPasteSummaryCaseFeature::onActionTriggered( bool isChecked )
{
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(
caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return;
std::vector<caf::PdmPointer<RimSummaryCase>> sourceObjects = RicPasteSummaryCaseFeature::summaryCases();

View File

@ -69,6 +69,7 @@ bool RicPasteSummaryCrossPlotFeature::isCommandEnabled()
{
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(
caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return false;
RimSummaryCrossPlotCollection* plotColl = nullptr;
destinationObject->firstAncestorOrThisOfType( plotColl );

View File

@ -74,6 +74,7 @@ RimSummaryCurve* RicPasteSummaryCurveFeature::copyCurveAndAddToPlot( RimSummaryC
bool RicPasteSummaryCurveFeature::isCommandEnabled()
{
caf::PdmObject* destinationObject = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return false;
RimSummaryPlot* summaryPlot = nullptr;
destinationObject->firstAncestorOrThisOfType( summaryPlot );

View File

@ -70,6 +70,8 @@ bool RicPasteSummaryPlotFeature::isCommandEnabled()
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(
caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return false;
RimSummaryPlotCollection* plotColl = nullptr;
destinationObject->firstAncestorOrThisOfType( plotColl );
if ( !plotColl )

View File

@ -46,6 +46,7 @@ bool RicPasteWellLogCurveFeature::isCommandEnabled()
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(
caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return false;
RimWellLogTrack* wellLogTrack = nullptr;
destinationObject->firstAncestorOrThisOfType( wellLogTrack );
@ -66,6 +67,7 @@ void RicPasteWellLogCurveFeature::onActionTriggered( bool isChecked )
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(
caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return;
RimWellLogTrack* wellLogTrack = nullptr;
destinationObject->firstAncestorOrThisOfType( wellLogTrack );

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 );

View File

@ -44,6 +44,7 @@ bool RicPasteWellLogTrackFeature::isCommandEnabled()
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(
caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return false;
RimWellLogPlot* wellLogPlot = nullptr;
RimWellRftPlot* rftPlot = nullptr;