Merge pull request #1404 from atgeirr/fix-no-wells

Ensure we do not dereference nullptr.
This commit is contained in:
Atgeirr Flø Rasmussen 2018-02-14 09:56:43 +01:00 committed by GitHub
commit 17a524e42c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1067,14 +1067,14 @@ namespace Opm {
int
BlackoilWellModel<TypeTag>:: numWells() const
{
return wells()->number_of_wells;
return wells() ? wells()->number_of_wells : 0;
}
template<typename TypeTag>
int
BlackoilWellModel<TypeTag>:: numPhases() const
{
return wells()->number_of_phases;
return wells() ? wells()->number_of_phases : 1;
}
template<typename TypeTag>