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>
This commit is contained in:
Tomaz Canabrava 2014-02-15 20:44:49 -02:00 committed by Dirk Hohndel
parent 191a3064a7
commit 021d799ff9

View file

@ -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)