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.
This commit is contained in:
Markus Blatt 2016-06-27 12:21:45 +02:00
parent 24fa367fda
commit 88ebfeba28

View File

@ -545,6 +545,12 @@ bool
wells_equal(const struct Wells *W1, const struct Wells *W2 , bool verbose) 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; bool are_equal = true;
are_equal = (W1->number_of_wells == W2->number_of_wells); are_equal = (W1->number_of_wells == W2->number_of_wells);
are_equal = are_equal && (W1->number_of_phases == W2->number_of_phases); are_equal = are_equal && (W1->number_of_phases == W2->number_of_phases);