summaryrefslogtreecommitdiffstats
path: root/statistics.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-20 14:47:18 -1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-20 14:47:18 -1000
commit75f6159a048443e86b67870c1de246cabb813d29 (patch)
tree8848ec0eb0954ea302880ca2b4f0ae845dc4ad27 /statistics.c
parent8bbe24f4854405b7967d3234489bb4c999be9537 (diff)
downloadsubsurface-75f6159a048443e86b67870c1de246cabb813d29.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'statistics.c')
-rw-r--r--statistics.c4
1 files changed, 4 insertions, 0 deletions
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);