UI restructure: fix get_divenr to do the right thing on a copy of a dive
We should not care if the dive has the same address in memory. We care if it is the same dive (by using the unique ID). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
91086d08ad
commit
b298306eb1
@ -339,7 +339,7 @@ int get_divenr(struct dive *dive)
|
||||
int i;
|
||||
struct dive *d;
|
||||
for_each_dive(i, d) {
|
||||
if (d == dive)
|
||||
if (d->id == dive->id) // don't compare pointers, we could be passing in a copy of the dive
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user