#2957 Crash with LGR model

Guard nullptr access in well_state.cpp
This commit is contained in:
Magne Sjaastad 2018-05-31 08:29:40 +02:00
parent b0ee5a2834
commit 4ca615e74a

View File

@ -447,11 +447,14 @@ static void well_state_add_LGR_connections(well_state_type * well_state,
int num_lgr = ecl_grid_get_num_lgr( grid );
for (int lgr_index = 0; lgr_index < num_lgr; lgr_index++) {
ecl_file_view_type * lgr_view = ecl_file_view_add_blockview(file_view , LGR_KW , lgr_index);
const char * grid_name = ecl_grid_iget_lgr_name( grid , lgr_index );
int well_nr = well_state_get_lgr_well_nr( well_state , lgr_view );
if (well_nr >= 0)
well_state_add_connections__( well_state , lgr_view , grid_name , lgr_index + 1, well_nr );
}
if (lgr_view)
{
const char * grid_name = ecl_grid_iget_lgr_name( grid , lgr_index );
int well_nr = well_state_get_lgr_well_nr( well_state , lgr_view );
if (well_nr >= 0)
well_state_add_connections__( well_state , lgr_view , grid_name , lgr_index + 1, well_nr );
}
}
}