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>
This commit is contained in:
Berthold Stoeger 2018-10-15 23:12:13 +02:00 committed by Dirk Hohndel
parent 3c1002d7ef
commit 0e00d40ead

View file

@ -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)