aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-02-15 20:44:49 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-15 17:14:49 -0800
commit021d799ff9346e602b8a19c296610a9bda98d970 (patch)
treea4c2a29b50794157d5ac74fb84854f8c1cd67479 /qt-ui/profile
parent191a3064a7e54e8e8209cc93d054f678e4d61a10 (diff)
downloadsubsurface-021d799ff9346e602b8a19c296610a9bda98d970.tar.gz
Fix crash opening testdive0.xml
That particular dive didn't have a temperature, and thus we got a crash while accessing the last temperature text. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/diveprofileitem.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index a07132fbb..58dfa4933 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -267,7 +267,8 @@ void DiveTemperatureItem::modelDataChanged(const QModelIndex& topLeft, const QMo
((abs(last_valid_temp - last_printed_temp) > 500) || ((double)last / (double)sec < 0.75))) {
createTextItem(sec, last_valid_temp);
}
- texts.last()->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
+ if( texts.count())
+ texts.last()->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
}
void DiveTemperatureItem::createTextItem(int sec, int mkelvin)