diff options
Diffstat (limited to 'planner.c')
-rw-r--r-- | planner.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1138,8 +1138,8 @@ static gboolean starttime_focus_out_cb(GtkWidget *entry, GdkEvent * event, gpoin /* we alway make this relative - either from the current time or from the * end of the last dive, whichever is later */ timestamp_t cur = current_time_notz(); - if (dive_table.nr) { - struct dive *last_dive = get_dive(dive_table.nr - 1); + if (diveplan.lastdive_nr >= 0) { + struct dive *last_dive = get_dive(diveplan.lastdive_nr); if (last_dive && last_dive->when + last_dive->dc.duration.seconds > cur) cur = last_dive->when + last_dive->dc.duration.seconds; } @@ -1285,6 +1285,7 @@ void input_plan() if (diveplan.dp) free_dps(diveplan.dp); memset(&diveplan, 0, sizeof(diveplan)); + diveplan.lastdive_nr = dive_table.nr - 1; free(cache_data); cache_data = NULL; planned_dive = NULL; |