From 0e00d40ead4c8a87a0dbc685db4efda2b9d2205c Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 15 Oct 2018 23:12:13 +0200 Subject: Selection: always make newly selected dive the current dive In select_dive(), the selected dive would only be made the current dive, if it wasn't previously selected. If multiple dives were selected and the user clicked on one of them which is not the current dive, then the current dive would be deselected and thus not be the current dive anymore. The only remaining dive would not be made the current dive, because it was already selected. End result: null dive shown. Therefore, always make the selected dive the current dive, even if it is already selected. Fixes #1792 Reported-by: Jan Mulder Signed-off-by: Berthold Stoeger --- core/divelist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/divelist.c b/core/divelist.c index ec088a87e..0722953ae 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -1249,11 +1249,13 @@ struct dive *merge_two_dives(struct dive *a, struct dive *b) void select_dive(struct dive *dive) { - if (dive && !dive->selected) { + if (!dive) + return; + if (!dive->selected) { dive->selected = 1; amount_selected++; - current_dive = dive; } + current_dive = dive; } void deselect_dive(struct dive *dive) -- cgit v1.2.3-70-g09d2