diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp index 84fbe522ec..7522865d98 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp @@ -251,8 +251,7 @@ void RifEclipseRestartFilesetAccess::readWellData(well_info_type* well_info, boo if (m_ecl_files[i]) { - const char* fileName = ecl_file_get_src_file(m_ecl_files[i]); - int reportNumber = ecl_util_filename_report_nr(fileName); + int reportNumber = RifEclipseRestartFilesetAccess::reportNumber(m_ecl_files[i]); if(reportNumber != -1) { well_info_add_wells(well_info, m_ecl_files[i], reportNumber, importCompleteMswData); @@ -284,6 +283,23 @@ void RifEclipseRestartFilesetAccess::openTimeStep(size_t timeStep) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifEclipseRestartFilesetAccess::reportNumber(const ecl_file_type* ecl_file) +{ + if (!ecl_file) return -1; + + const char* eclFileName = ecl_file_get_src_file(ecl_file); + QString fileNameUpper(eclFileName); + fileNameUpper = fileNameUpper.toUpper(); + + // Convert to upper case, as ecl_util_filename_report_nr does not handle lower case file extensions + int reportNumber = ecl_util_filename_report_nr(fileNameUpper.toAscii().data()); + + return reportNumber; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -319,9 +335,11 @@ std::vector RifEclipseRestartFilesetAccess::reportNumbers() { if (ecl_file) { - const char* fileName = ecl_file_get_src_file(ecl_file); - int reportNumber = ecl_util_filename_report_nr(fileName); - reportNr.push_back(reportNumber); + int reportNumber = RifEclipseRestartFilesetAccess::reportNumber(ecl_file); + if (reportNumber != -1) + { + reportNr.push_back(reportNumber); + } } } diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h index 493c1f74bc..a5a68101cf 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h @@ -58,6 +58,7 @@ public: private: void openTimeStep(size_t timeStep); + static int reportNumber(const ecl_file_type* ecl_file); private: QStringList m_fileNames; diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h index 059b5c41e7..bab42e2063 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h +++ b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h @@ -50,6 +50,11 @@ private: template void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex) { + if (timeStepIndex >= m_resultsData->cellScalarResults(m_scalarResultIndex).size()) + { + return; + } + std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); if (values.empty())