From 75f6159a048443e86b67870c1de246cabb813d29 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 20 Dec 2012 14:47:18 -1000 Subject: If no dives are selected, clear the stats widget Previously we had lots of zeros and some non-sensical data displayed (the temp values were actually not zeroed out). Signed-off-by: Dirk Hohndel --- statistics.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/statistics.c b/statistics.c index 6b428d5ea..8ec8ad662 100644 --- a/statistics.c +++ b/statistics.c @@ -678,6 +678,10 @@ static void show_total_dive_stats(struct dive *dive) get_selected_dives_text(buffer, sizeof(buffer)); set_label(stats_w.framelabel, "Statistics %s", buffer); set_label(stats_w.selection_size, "%d", stats_ptr->selection_size); + if (stats_ptr->selection_size == 0) { + clear_stats_widgets(); + return; + } if (stats_ptr->min_temp) { value = get_temp_units(stats_ptr->min_temp, &unit); set_label(stats_w.min_temp, "%.1f %s", value, unit); -- cgit v1.2.3-70-g09d2