mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
Guard against missing RFT reader when creating an RFT curve
addRftCurve() selects the first Eclipse result case in the project without checking that it has an RFT reader, and then dereferences rftReader(). The command is enabled by hasRftData(), which returns true if any case has a reader, so with several Eclipse cases loaded an enabled menu entry can select a case with no RFT data and crash. Null check the reader before use, matching the guard already used by hasRftData() and hasRftDataForWell().
This commit is contained in:
1 parent
c0ebe1a331
commit
240df658ee
1 file changed
+9
-4
@@ -357,11 +357,16 @@ RimWellLogRftCurve* RicWellLogTools::addRftCurve( RimWellLogTrack* plotTrack, co
|
||||
{
|
||||
curve->setEclipseCase( resultCase );
|
||||
|
||||
auto wellNames = resultCase->rftReader()->wellNames();
|
||||
if ( !wellNames.empty() )
|
||||
// The case selected above is the first Eclipse result case, which is not guaranteed to have an RFT reader. See
|
||||
// hasRftData() that requires a reader to be present.
|
||||
if ( auto* rftReader = resultCase->rftReader() )
|
||||
{
|
||||
auto wellName = *( wellNames.begin() );
|
||||
curve->setDefaultAddress( wellName );
|
||||
auto wellNames = rftReader->wellNames();
|
||||
if ( !wellNames.empty() )
|
||||
{
|
||||
auto wellName = *( wellNames.begin() );
|
||||
curve->setDefaultAddress( wellName );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user