Guard nullpointer access and catch exceptions

This commit is contained in:
Magne Sjaastad
2021-06-14 08:01:28 +02:00
parent 00e28f6515
commit 24c2eeb022
2 changed files with 2885 additions and 2890 deletions

View File

@@ -718,7 +718,7 @@ QList<caf::PdmOptionItemInfo>
} }
if ( resType == RiaDefines::ResultCatType::FLOW_DIAGNOSTICS && m_eclipseCase && if ( resType == RiaDefines::ResultCatType::FLOW_DIAGNOSTICS && m_eclipseCase &&
m_eclipseCase->eclipseCaseData()->hasFractureResults() ) m_eclipseCase->eclipseCaseData() && m_eclipseCase->eclipseCaseData()->hasFractureResults() )
{ {
// Flow diagnostics is not supported for dual porosity models // Flow diagnostics is not supported for dual porosity models
continue; continue;

View File

@@ -18,26 +18,9 @@
#include "RimVfpTableExtractor.h" #include "RimVfpTableExtractor.h"
// #include "RiaApplication.h"
// #include "RimCase.h"
// #include "RimEclipseCase.h"
// #include "RimGeoMechCase.h"
// #include "RimOilField.h"
// #include "RimProject.h"
// #include "RimWellLogFile.h"
// #include "RimWellPath.h"
// #include "RimWellPathCollection.h"
#include "cafPdmUiItem.h" #include "cafPdmUiItem.h"
#include "cafUtils.h" #include "cafUtils.h"
// #include <QDateTime>
// #include <QDir>
// #include <QFileInfo>
// #include "opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp"
// #include "opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp"
#include "opm/parser/eclipse/Parser/Parser.hpp" #include "opm/parser/eclipse/Parser/Parser.hpp"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -47,20 +30,26 @@ std::vector<Opm::VFPInjTable> RimVfpTableExtractor::extractVfpInjectionTables( c
{ {
std::vector<Opm::VFPInjTable> tables; std::vector<Opm::VFPInjTable> tables;
Opm::Parser parser; try
auto deck = parser.parseFile( filename );
std::string myKeyword = "VFPINJ";
auto keywordList = deck.getKeywordList( myKeyword );
Opm::UnitSystem unitSystem;
for ( auto kw : keywordList )
{ {
auto name = kw->name(); Opm::Parser parser;
auto deck = parser.parseFile( filename );
Opm::VFPInjTable table( *kw, unitSystem ); std::string myKeyword = "VFPINJ";
tables.push_back( table ); auto keywordList = deck.getKeywordList( myKeyword );
Opm::UnitSystem unitSystem;
for ( auto kw : keywordList )
{
auto name = kw->name();
Opm::VFPInjTable table( *kw, unitSystem );
tables.push_back( table );
}
}
catch ( ... )
{
} }
return tables; return tables;
@@ -73,20 +62,26 @@ std::vector<Opm::VFPProdTable> RimVfpTableExtractor::extractVfpProductionTables(
{ {
std::vector<Opm::VFPProdTable> tables; std::vector<Opm::VFPProdTable> tables;
Opm::Parser parser; try
auto deck = parser.parseFile( filename );
std::string myKeyword = "VFPPROD";
auto keywordList = deck.getKeywordList( myKeyword );
Opm::UnitSystem unitSystem;
for ( auto kw : keywordList )
{ {
auto name = kw->name(); Opm::Parser parser;
auto deck = parser.parseFile( filename );
Opm::VFPProdTable table( *kw, unitSystem ); std::string myKeyword = "VFPPROD";
tables.push_back( table ); auto keywordList = deck.getKeywordList( myKeyword );
Opm::UnitSystem unitSystem;
for ( auto kw : keywordList )
{
auto name = kw->name();
Opm::VFPProdTable table( *kw, unitSystem );
tables.push_back( table );
}
}
catch ( ... )
{
} }
return tables; return tables;