From 2fea355cd26d096b9651aeca633ea413415d70ce Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 9 Sep 2022 08:17:58 +0200 Subject: [PATCH] Thermal Fracture: Fix off-by-one in properties parsing. Would leave out the last element from the file (i.e LeakoffPressureDrop). --- .../FileInterface/RifThermalFractureReader.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifThermalFractureReader.cpp b/ApplicationLibCode/FileInterface/RifThermalFractureReader.cpp index 46a0f60f4b..4ca55d517f 100644 --- a/ApplicationLibCode/FileInterface/RifThermalFractureReader.cpp +++ b/ApplicationLibCode/FileInterface/RifThermalFractureReader.cpp @@ -50,11 +50,15 @@ std::pair, QString> auto appendPropertyValues = [definition]( int nodeIndex, int valueOffset, const QStringList& values ) { CAF_ASSERT( valueOffset <= values.size() ); - for ( int i = valueOffset; i < values.size() - 1; i++ ) + for ( int i = valueOffset; i < values.size(); i++ ) { - double value = values[i].toDouble(); - int propertyIndex = i - valueOffset; - definition->appendPropertyValue( propertyIndex, nodeIndex, value ); + bool isOk = false; + double value = values[i].toDouble( &isOk ); + if ( isOk ) + { + int propertyIndex = i - valueOffset; + definition->appendPropertyValue( propertyIndex, nodeIndex, value ); + } } }; @@ -80,7 +84,7 @@ std::pair, QString> if ( isFirstHeader ) { // Create the result vector when encountering the first header - for ( int i = valueOffset; i < headerValues.size() - 1; i++ ) + for ( int i = valueOffset; i < headerValues.size(); i++ ) { auto [name, unit] = parseNameAndUnit( headerValues[i] ); if ( !name.isEmpty() && !unit.isEmpty() ) definition->addProperty( name, unit );