CppCheck : Avoid potential null pointer access

This commit is contained in:
Magne Sjaastad 2017-09-07 20:33:17 +02:00
parent ffb7e42b0f
commit 8ecfaa2ea7
2 changed files with 5 additions and 10 deletions

View File

@ -55,12 +55,8 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellItem = nullptr;
if (selItem->type() == RiuSelectionItem::SIMWELL_SELECTION_OBJECT)
{
simWellItem = static_cast<RiuSimWellSelectionItem*>(selItem);
if (!simWellItem) return;
}
RiuSimWellSelectionItem* simWellItem = static_cast<RiuSimWellSelectionItem*>(selItem);
if (!simWellItem) return;
RimEclipseWell* simWell = simWellItem->m_simWell;
if (!simWell) return;

View File

@ -321,6 +321,9 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
{
caf::SelectionManager::instance()->setSelectedItem(well);
RiuSelectionItem* selItem = new RiuSimWellSelectionItem(eclipseWellSourceInfo->well(), m_currentPickPositionInDomainCoords, eclipseWellSourceInfo->branchIndex());
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
commandIds << "RicNewWellLogCurveExtractionFeature";
commandIds << "RicShowWellAllocationPlotFeature";
commandIds << "RicPlotProductionRateFeature";
@ -328,10 +331,6 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
commandIds << "RicShowContributingWellsFeature";
commandIds << "Separator";
commandIds << "RicNewSimWellIntersectionFeature";
RiuSelectionItem* selItem = new RiuSimWellSelectionItem(eclipseWellSourceInfo->well(), m_currentPickPositionInDomainCoords, eclipseWellSourceInfo->branchIndex());
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
commandIds << "RicPlotProductionRateFeature";
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
commandIds << "RicNewSimWellFractureAtPosFeature";