mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
amount_selected should never be decremented if already 0
this is probably more a workaround than a proper fix to a problem which I think only happens if started with no dive loaded and then create one. in that case, deselect_dive is called after saving the dive but probalby before it was added to the dive list properly resulting in an underflow of amount_selected. Signed-off-by: Martin Gysel <me@bearsh.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d9ca999a17
commit
c1a9e7c996
1 changed files with 2 additions and 1 deletions
|
@ -820,6 +820,7 @@ void deselect_dive(int idx)
|
||||||
struct dive *dive = get_dive(idx);
|
struct dive *dive = get_dive(idx);
|
||||||
if (dive && dive->selected) {
|
if (dive && dive->selected) {
|
||||||
dive->selected = 0;
|
dive->selected = 0;
|
||||||
|
if (amount_selected)
|
||||||
amount_selected--;
|
amount_selected--;
|
||||||
if (selected_dive == idx && amount_selected > 0) {
|
if (selected_dive == idx && amount_selected > 0) {
|
||||||
/* pick a different dive as selected */
|
/* pick a different dive as selected */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue