mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
CppCheck : Several fixes
Add missing initializers Guard potential null pointer access
This commit is contained in:
@@ -81,20 +81,22 @@ void RicExportFaultsFeature::onActionTriggered(bool isChecked)
|
||||
RimEclipseCase* eclCase = nullptr;
|
||||
rimFault->firstAncestorOrThisOfType(eclCase);
|
||||
|
||||
QString caseName;
|
||||
if (eclCase)
|
||||
{
|
||||
QString caseName = eclCase->caseUserDescription();
|
||||
|
||||
if (eclCase) caseName = eclCase->caseUserDescription();
|
||||
QString faultName = rimFault->name();
|
||||
if (faultName == RiaDefines::undefinedGridFaultName()) faultName = "UNDEF";
|
||||
if (faultName == RiaDefines::undefinedGridFaultWithInactiveName()) faultName = "UNDEF_IA";
|
||||
|
||||
QString faultName = rimFault->name();
|
||||
if ( faultName == RiaDefines::undefinedGridFaultName() ) faultName = "UNDEF";
|
||||
if ( faultName == RiaDefines::undefinedGridFaultWithInactiveName() ) faultName = "UNDEF_IA";
|
||||
QString baseFilename = "Fault_" + faultName + "_" + caseName;
|
||||
baseFilename = caf::Utils::makeValidFileBasename(baseFilename);
|
||||
|
||||
QString baseFilename = "Fault_" + faultName + "_" + caseName;
|
||||
baseFilename = caf::Utils::makeValidFileBasename(baseFilename);
|
||||
QString completeFilename = selectedDir + "/" + baseFilename + ".grdecl";
|
||||
|
||||
QString completeFilename = selectedDir + "/" + baseFilename + ".grdecl";
|
||||
|
||||
RicExportFaultsFeature::saveFault(completeFilename, eclCase->eclipseCaseData()->mainGrid(), rimFault->faultGeometry()->faultFaces(), faultName);
|
||||
RicExportFaultsFeature::saveFault(
|
||||
completeFilename, eclCase->eclipseCaseData()->mainGrid(), rimFault->faultGeometry()->faultFaces(), faultName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -136,9 +136,10 @@ QImage RicGridStatisticsDialog::screenShotImage()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGridStatisticsDialog::setInfoText(RimGridView* view)
|
||||
{
|
||||
Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig();
|
||||
if (view && overlayInfo)
|
||||
if (view && view->overlayInfoConfig())
|
||||
{
|
||||
Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig();
|
||||
|
||||
QString text;
|
||||
text = overlayInfo->timeStepText();
|
||||
text += overlayInfo->caseInfoText();
|
||||
@@ -156,9 +157,10 @@ void RicGridStatisticsDialog::setHistogramData(RimGridView* view)
|
||||
deletePlotItems(m_historgramPlot);
|
||||
deletePlotItems(m_aggregatedPlot);
|
||||
|
||||
Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig();
|
||||
if (view && overlayInfo)
|
||||
if (view && view->overlayInfoConfig())
|
||||
{
|
||||
Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig();
|
||||
|
||||
auto hist = new QwtPlotHistogram("Histogram");
|
||||
auto aggr = new QwtPlotCurve("Aggregated");
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicSummaryCurveCalculatorEditor::RicSummaryCurveCalculatorEditor()
|
||||
: m_pdmTableView(nullptr)
|
||||
{
|
||||
m_calculator = std::unique_ptr<RicSummaryCurveCalculator>(new RicSummaryCurveCalculator);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ void RicWellLogFileCloseFeature::onActionTriggered(bool isChecked)
|
||||
RimWellPath* parentWellPath;
|
||||
wellLogFile->firstAncestorOrThisOfType(parentWellPath);
|
||||
|
||||
if (parentWellPath != nullptr)
|
||||
if (parentWellPath)
|
||||
{
|
||||
std::set<RimViewWindow*> referringPlots = referringWellLogPlots(wellLogFile);
|
||||
parentWellPath->deleteWellLogFile(wellLogFile);
|
||||
@@ -69,8 +69,9 @@ void RicWellLogFileCloseFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
plot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
parentWellPath->updateConnectedEditors();
|
||||
}
|
||||
parentWellPath->updateConnectedEditors();
|
||||
}
|
||||
|
||||
caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors();
|
||||
|
||||
@@ -63,40 +63,45 @@ bool RicWellPathViewerEventHandler::handleEvent(const RicViewerEventObject& even
|
||||
{
|
||||
const auto & partAndTriangleIndexPair = eventObject.m_partAndTriangleIndexPairs.front();
|
||||
const cvf::Part* part = partAndTriangleIndexPair.first;
|
||||
|
||||
const RivObjectSourceInfo* sourceInfo = dynamic_cast<const RivObjectSourceInfo*>(part->sourceInfo());
|
||||
if (sourceInfo)
|
||||
{
|
||||
if (dynamic_cast<RimPerforationInterval*>(sourceInfo->object()))
|
||||
{
|
||||
objectToSelect = sourceInfo->object();
|
||||
|
||||
if (eventObject.m_partAndTriangleIndexPairs.size() > 1)
|
||||
if (part)
|
||||
{
|
||||
const RivObjectSourceInfo* sourceInfo = dynamic_cast<const RivObjectSourceInfo*>(part->sourceInfo());
|
||||
if (sourceInfo)
|
||||
{
|
||||
if (dynamic_cast<RimPerforationInterval*>(sourceInfo->object()))
|
||||
{
|
||||
const auto& secondPair = eventObject.m_partAndTriangleIndexPairs[1];
|
||||
const cvf::Part* secondPickedPart = secondPair.first;
|
||||
if (secondPickedPart)
|
||||
objectToSelect = sourceInfo->object();
|
||||
|
||||
if (eventObject.m_partAndTriangleIndexPairs.size() > 1)
|
||||
{
|
||||
auto wellPathSourceCandidate = dynamic_cast<const RivWellPathSourceInfo*>(secondPickedPart->sourceInfo());
|
||||
if (wellPathSourceCandidate)
|
||||
const auto& secondPair = eventObject.m_partAndTriangleIndexPairs[1];
|
||||
const cvf::Part* secondPickedPart = secondPair.first;
|
||||
if (secondPickedPart)
|
||||
{
|
||||
RimWellPath* perforationWellPath = nullptr;
|
||||
objectToSelect->firstAncestorOrThisOfType(perforationWellPath);
|
||||
if (perforationWellPath == wellPathSourceCandidate->wellPath())
|
||||
auto wellPathSourceCandidate =
|
||||
dynamic_cast<const RivWellPathSourceInfo*>(secondPickedPart->sourceInfo());
|
||||
if (wellPathSourceCandidate)
|
||||
{
|
||||
wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(secondPickedPart->sourceInfo());
|
||||
wellPathTriangleIndex = secondPair.second;
|
||||
RimWellPath* perforationWellPath = nullptr;
|
||||
objectToSelect->firstAncestorOrThisOfType(perforationWellPath);
|
||||
if (perforationWellPath == wellPathSourceCandidate->wellPath())
|
||||
{
|
||||
wellPathSourceInfo =
|
||||
dynamic_cast<const RivWellPathSourceInfo*>(secondPickedPart->sourceInfo());
|
||||
wellPathTriangleIndex = secondPair.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (part && dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo()))
|
||||
{
|
||||
wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo());
|
||||
wellPathTriangleIndex = partAndTriangleIndexPair.second;
|
||||
if (dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo()))
|
||||
{
|
||||
wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo());
|
||||
wellPathTriangleIndex = partAndTriangleIndexPair.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user