mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Bugfix crash in trip statistics for non trip dives
This fixes a crash when you have non-trip dives in your logbook. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ce525bd285
commit
a25d351b64
1 changed files with 16 additions and 14 deletions
30
statistics.c
30
statistics.c
|
@ -155,22 +155,24 @@ void process_all_dives(struct dive *dive, struct dive **prev_dive)
|
|||
stats_yearly[year_iter].selection_size++;
|
||||
stats_yearly[year_iter].period = current_year;
|
||||
|
||||
if (trip_ptr != dp->divetrip) {
|
||||
trip_ptr = dp->divetrip;
|
||||
trip_iter++;
|
||||
if (dp->divetrip != NULL) {
|
||||
if (trip_ptr != dp->divetrip) {
|
||||
trip_ptr = dp->divetrip;
|
||||
trip_iter++;
|
||||
}
|
||||
|
||||
/* stats_by_trip[0] is all the dives combined */
|
||||
stats_by_trip[0].selection_size++;
|
||||
process_dive(dp, &(stats_by_trip[0]));
|
||||
stats_by_trip[0].is_trip = TRUE;
|
||||
stats_by_trip[0].location = strdup("All (by trip stats)");
|
||||
|
||||
process_dive(dp, &(stats_by_trip[trip_iter]));
|
||||
stats_by_trip[trip_iter].selection_size++;
|
||||
stats_by_trip[trip_iter].is_trip = TRUE;
|
||||
stats_by_trip[trip_iter].location = dp->divetrip->location;
|
||||
}
|
||||
|
||||
/* stats_by_trip[0] is all the dives combined */
|
||||
stats_by_trip[0].selection_size++;
|
||||
process_dive(dp, &(stats_by_trip[0]));
|
||||
stats_by_trip[0].is_trip = TRUE;
|
||||
stats_by_trip[0].location = strdup("All (by trip stats)");
|
||||
|
||||
process_dive(dp, &(stats_by_trip[trip_iter]));
|
||||
stats_by_trip[trip_iter].selection_size++;
|
||||
stats_by_trip[trip_iter].is_trip = TRUE;
|
||||
stats_by_trip[trip_iter].location = dp->divetrip->location;
|
||||
|
||||
/* monthly statistics */
|
||||
if (current_month == 0) {
|
||||
current_month = tm.tm_mon + 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue