mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-27 15:41:00 -05:00
#12419 Avoid assert during load of simulation case
Validate incoming parameters before use
This commit is contained in:
1 parent
5c2869d75f
commit
fae4623477
3 files changed
+19
-11
No files matched your search
@@ -39,6 +39,8 @@ void RifInputPropertyLoader::loadAndSynchronizeInputProperties( RimEclipseInputP
|
||||
const std::vector<QString>& filenames,
|
||||
bool allowImportOfFaults )
|
||||
{
|
||||
if ( !inputPropertyCollection || !eclipseCaseData || filenames.empty() ) return;
|
||||
|
||||
std::vector<RimEclipseInputProperty*> existingProperties = inputPropertyCollection->inputProperties.childrenByType();
|
||||
|
||||
caf::ProgressInfo progInfo( static_cast<int>( filenames.size() ), "Reading Input properties" );
|
||||
|
||||
@@ -704,18 +704,12 @@ void RimEclipseCase::loadAndSynchronizeInputProperties( bool importGridOrFaultDa
|
||||
{
|
||||
// Make sure we actually have reservoir data
|
||||
|
||||
CVF_ASSERT( eclipseCaseData() );
|
||||
CVF_ASSERT( eclipseCaseData()->mainGrid()->cellCount() != 0 );
|
||||
if ( !eclipseCaseData() || !eclipseCaseData()->mainGrid() || ( eclipseCaseData()->mainGrid()->cellCount() == 0 ) ) return;
|
||||
|
||||
// Then read the properties from all the files referenced by the InputReservoir
|
||||
|
||||
std::vector<QString> filenames;
|
||||
for ( const QString& fileName : additionalFiles() )
|
||||
{
|
||||
filenames.push_back( fileName );
|
||||
}
|
||||
|
||||
RifInputPropertyLoader::loadAndSynchronizeInputProperties( inputPropertyCollection(), eclipseCaseData(), filenames, importGridOrFaultData );
|
||||
RifInputPropertyLoader::loadAndSynchronizeInputProperties( inputPropertyCollection(),
|
||||
eclipseCaseData(),
|
||||
additionalFiles(),
|
||||
importGridOrFaultData );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -240,6 +240,18 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( eclipseCase->mainGrid() == nullptr )
|
||||
{
|
||||
RiaLogging::error( "Eclipse grid file does not contain a valid grid." );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( eclipseCase->mainGrid()->cellCount() == 0 )
|
||||
{
|
||||
RiaLogging::error( "Eclipse grid file does not contain any cells." );
|
||||
return false;
|
||||
}
|
||||
|
||||
setFilesContainingFaults( readerInterface->filenamesWithFaults() );
|
||||
|
||||
setReservoirData( eclipseCase.p() );
|
||||
|
||||
Reference in new issue
Block a user