From 5123d5d0c58f6948ff6b918f062bbebe104a177a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 24 Apr 2019 07:41:11 +0200 Subject: [PATCH] #4351 Regression test : Guard null pointer access --- ApplicationCode/ProjectDataModel/Rim3dView.cpp | 14 +++++++++----- .../ProjectDataModel/RimEclipseView.cpp | 2 +- ApplicationCode/UserInterface/RiuMainWindow.cpp | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Rim3dView.cpp b/ApplicationCode/ProjectDataModel/Rim3dView.cpp index daaaeb9169..38f62ddb53 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dView.cpp @@ -465,15 +465,19 @@ RimWellPathCollection* Rim3dView::wellPathCollection() const //-------------------------------------------------------------------------------------------------- bool Rim3dView::hasVisibleTimeStepDependent3dWellLogCurves() const { - std::vector wellLogCurves; - wellPathCollection()->descendantsIncludingThisOfType(wellLogCurves); - for (const Rim3dWellLogCurve* curve : wellLogCurves) + if (wellPathCollection()) { - if (curve->showInView(this) && curve->isShowingTimeDependentResult()) + std::vector wellLogCurves; + wellPathCollection()->descendantsIncludingThisOfType(wellLogCurves); + for (const Rim3dWellLogCurve* curve : wellLogCurves) { - return true; + if (curve->showInView(this) && curve->isShowingTimeDependentResult()) + { + return true; + } } } + return false; } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 5104b0bfae..174f2f5f62 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -1717,7 +1717,7 @@ bool RimEclipseView::isTimeStepDependentDataVisible() const if (this->faultResultSettings()->customFaultResult()->isTernarySaturationSelected()) return true; } - if (this->wellPathCollection()->anyWellsContainingPerforationIntervals()) return true; + if (this->wellPathCollection() && this->wellPathCollection()->anyWellsContainingPerforationIntervals()) return true; if (this->hasVisibleTimeStepDependent3dWellLogCurves()) return true; diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index 2a6e48dcf0..9da94800f0 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -1638,7 +1638,7 @@ void RiuMainWindow::refreshDrawStyleActions() if (!eclView) { Rim2dIntersectionView* intView = dynamic_cast(view); - if (intView) + if (intView && intView->intersection()) { intView->intersection()->firstAncestorOrThisOfType(eclView); }