From 88ebfeba282c9ae70fa04855aaecdaea2ef6e1ac Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Mon, 27 Jun 2016 12:21:45 +0200 Subject: [PATCH] Make wells_equal work for null wells. This is needed to run test cases without wells with debugging on. Without this commit we get segmentation fault in an assert statement. --- opm/core/wells/wells.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/opm/core/wells/wells.c b/opm/core/wells/wells.c index 026b470e3..3e59efd94 100644 --- a/opm/core/wells/wells.c +++ b/opm/core/wells/wells.c @@ -545,6 +545,12 @@ bool wells_equal(const struct Wells *W1, const struct Wells *W2 , bool verbose) /* ---------------------------------------------------------------------- */ { + // Cater the case where W1 and W2 are the same (null) pointers. + if( W1 == W2 ) + { + return true; + } + bool are_equal = true; are_equal = (W1->number_of_wells == W2->number_of_wells); are_equal = are_equal && (W1->number_of_phases == W2->number_of_phases);