mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Use displayed_dc instead of current_dc
current_dc is a macro that determines the dive computer based on the current dive number. When the planner is started from an emtpy dive list, the dive number ends up being -1 and that doesn't produce a valid dive computer. Use the divecomputer of the displayed_dive instead. This is done via a macro that can also be used in two other places. Without this patch, the planner crashed when called on an empty dive list. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
a9b692f0c3
commit
a422957cd6
4 changed files with 3 additions and 3 deletions
|
@ -909,6 +909,7 @@ void MainWindow::setupForAddAndPlan(const char *model)
|
|||
displayed_dive.id = dive_getUniqID(&displayed_dive);
|
||||
displayed_dive.when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset() + 3600;
|
||||
displayed_dive.dc.model = strdup(model); // don't translate! this is stored in the XML file
|
||||
dc_number = 1;
|
||||
// setup the dive cylinders
|
||||
DivePlannerPointsModel::instance()->clear();
|
||||
DivePlannerPointsModel::instance()->setupCylinders();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue