summaryrefslogtreecommitdiffstats
path: root/core/divelist.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-15 23:12:13 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-15 20:57:10 -0400
commit0e00d40ead4c8a87a0dbc685db4efda2b9d2205c (patch)
tree81bd0997f967b8f67fc6a2fad73c927e6666ba37 /core/divelist.c
parent3c1002d7ef83a67db89d52dd7c58b267b3870dc3 (diff)
downloadsubsurface-0e00d40ead4c8a87a0dbc685db4efda2b9d2205c.tar.gz
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 <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/divelist.c')
-rw-r--r--core/divelist.c6
1 files 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)