From b298306eb1217609e65b2817605c1115e4d4873e Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 2 Jul 2014 12:42:47 -0700 Subject: [PATCH] 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 --- divelist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/divelist.c b/divelist.c index 81dd16e87..d1634a634 100644 --- a/divelist.c +++ b/divelist.c @@ -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;