mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix crash when adding dive to empty dive list
Only look up the dive number of a previous dive if there is a previous dive. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5935f372ab
commit
21b7ebbaf0
1 changed files with 3 additions and 1 deletions
|
@ -421,7 +421,9 @@ void MainTab::acceptChanges()
|
|||
if (editMode == ADD) {
|
||||
// clean up the dive data (get duration, depth information from samples)
|
||||
fixup_dive(current_dive);
|
||||
if (current_dive == get_dive(dive_table.nr - 1) && get_dive(dive_table.nr - 2)->number)
|
||||
if (dive_table.nr == 1)
|
||||
current_dive->number = 1;
|
||||
else if (current_dive == get_dive(dive_table.nr - 1) && get_dive(dive_table.nr - 2)->number)
|
||||
current_dive->number = get_dive(dive_table.nr - 2)->number + 1;
|
||||
DivePlannerPointsModel::instance()->cancelPlan();
|
||||
mainWindow()->showProfile();
|
||||
|
|
Loading…
Add table
Reference in a new issue