summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2013-11-30 14:40:32 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-30 07:46:17 -0800
commit5a1a25a4760463262f52a75cbc0e57340688024b (patch)
tree1982688236465b984130e183963982e138b8ed4e /qt-ui
parentf7efc0781738b9d6a9128f6e66bfc9b47c912910 (diff)
downloadsubsurface-5a1a25a4760463262f52a75cbc0e57340688024b.tar.gz
Fix a crash when no trip exists
When there are no trips at all, we have to skip the Yearly statistics alltogether, including the header line (that should display all the dives added together). Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/models.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 6600bfaf6..e16312845 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1448,7 +1448,7 @@ void YearlyStatisticsModel::update_yearly_stats()
}
- if (stats_by_trip != NULL ) {
+ if (stats_by_trip != NULL && stats_by_trip[0].is_trip == TRUE) {
YearStatisticsItem *item = new YearStatisticsItem(stats_by_trip[0]);
for (i = 1; stats_by_trip != NULL && stats_by_trip[i].is_trip; ++i) {
YearStatisticsItem *iChild = new YearStatisticsItem(stats_by_trip[i]);