From 13130ae268f2b3ccbed89527924acdbf05ee5666 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 5 Feb 2021 15:38:02 +0100 Subject: [PATCH] #7339 StimPlanModel: Handle incomplete formation names data. --- .../RimStimPlanModelElasticPropertyCalculator.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp index 910044068d..16d15ee377 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp @@ -225,9 +225,18 @@ bool RimStimPlanModelElasticPropertyCalculator::calculate( RiaDefines::CurveProp for ( size_t i = 0; i < tvDepthValues.size(); i++ ) { // Avoid using the field name in the match for now - QString fieldName = ""; - QString faciesName = findFaciesName( *colorLegend, faciesValues[i] ); - int idx = static_cast( formationValues[i] ); + QString fieldName = ""; + QString faciesName = findFaciesName( *colorLegend, faciesValues[i] ); + int idx = static_cast( formationValues[i] ); + if ( std::isinf( formationValues[i] ) || idx < 0 || idx >= static_cast( formationNamesVector.size() ) ) + { + RiaLogging::error( QString( "Unknown formation found in elastic properties. Value: %1, tvd: %2" ) + .arg( formationValues[i] ) + .arg( tvDepthValues[i] ) ); + values.clear(); + return false; + } + QString formationName = formationNamesVector[idx]; double porosity = poroValues[i];