#4716 Summary Case : Guard access to contained summary reader

This commit is contained in:
Magne Sjaastad 2019-09-13 13:17:07 +02:00
parent cdf1b85551
commit 07ab821646
5 changed files with 21 additions and 15 deletions

View File

@ -427,7 +427,7 @@ void RicExportFractureCompletionsImpl::getWellPressuresAndInitialProductionTimeS
{
RimSummaryCase* summaryCase = mainCollection->findSummaryCaseFromEclipseResultCase(resultCase);
if (summaryCase)
if (summaryCase && summaryCase->summaryReader())
{
std::vector<double> values;
if (summaryCase->summaryReader()->values(wbhpPressureAddress, &values))

View File

@ -37,7 +37,7 @@
//--------------------------------------------------------------------------------------------------
RimSummaryCurve* RicSummaryPlotFeatureImpl::addDefaultCurveToPlot(RimSummaryPlot* plot, RimSummaryCase* summaryCase)
{
if (plot)
if (plot && summaryCase && summaryCase->summaryReader())
{
RifEclipseSummaryAddress defaultAddressToUse;
@ -88,6 +88,9 @@ std::vector<RimSummaryCurve*> RicSummaryPlotFeatureImpl::addDefaultCurvesToPlot(
{
std::vector<RimSummaryCurve*> defaultCurves;
if (!plot) return defaultCurves;
if (!summaryCase || !summaryCase->summaryReader()) return defaultCurves;
QString curvesTextFilter = RiaApplication::instance()->preferences()->defaultSummaryCurvesTextFilter;
QStringList curveFilters = curvesTextFilter.split(";", QString::SkipEmptyParts);

View File

@ -276,7 +276,7 @@ std::set<RifEclipseSummaryAddress> RimSummaryCaseCollection::ensembleSummaryAddr
}
}
if (maxAddrIndex >= 0)
if (maxAddrIndex >= 0 && m_cases[maxAddrIndex]->summaryReader())
{
const std::set<RifEclipseSummaryAddress>& addrs = m_cases[maxAddrIndex]->summaryReader()->allResultAddresses();
addresses.insert(addrs.begin(), addrs.end());

View File

@ -515,16 +515,19 @@ void RimSummaryCurve::onLoadDataAndUpdate(bool updateParentPlot)
if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE)
{
auto reader = summaryCaseY()->summaryReader();
auto errAddress = reader->errorAddress(summaryAddressY());
if (errAddress.isValid())
if (reader)
{
std::vector<double> errValues;
reader->values(errAddress, &errValues);
m_qwtPlotCurve->setSamplesFromTimeTAndYValues(curveTimeStepsY, curveValuesY, errValues, isLogCurve);
}
else
{
m_qwtPlotCurve->setSamplesFromTimeTAndYValues(curveTimeStepsY, curveValuesY, isLogCurve);
auto errAddress = reader->errorAddress(summaryAddressY());
if (errAddress.isValid())
{
std::vector<double> errValues;
reader->values(errAddress, &errValues);
m_qwtPlotCurve->setSamplesFromTimeTAndYValues(curveTimeStepsY, curveValuesY, errValues, isLogCurve);
}
else
{
m_qwtPlotCurve->setSamplesFromTimeTAndYValues(curveTimeStepsY, curveValuesY, isLogCurve);
}
}
}
else

View File

@ -581,12 +581,12 @@ std::vector<RifSummaryReaderInterface*> RimSummaryPlotSourceStepping::summaryRea
{
for (auto curve : curveCollection->curves())
{
if (isYAxisStepping() && curve->summaryCaseY())
if (isYAxisStepping() && curve->summaryCaseY() && curve->summaryCaseY()->summaryReader())
{
readers.push_back(curve->summaryCaseY()->summaryReader());
}
if (isXAxisStepping() && curve->summaryCaseX())
if (isXAxisStepping() && curve->summaryCaseX() && curve->summaryCaseX()->summaryReader())
{
readers.push_back(curve->summaryCaseX()->summaryReader());
}
@ -602,7 +602,7 @@ std::vector<RifSummaryReaderInterface*> RimSummaryPlotSourceStepping::summaryRea
{
for (auto curve : curveSet->curves())
{
if (isYAxisStepping() && curve->summaryCaseY())
if (isYAxisStepping() && curve->summaryCaseY() && curve->summaryCaseY()->summaryReader())
{
readers.push_back(curve->summaryCaseY()->summaryReader());
}