Profile2: Prevent a crash if no dives are present

But in general we should not show the profile of a dive that
was recently removed from the list - e.g. via File->Close.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2014-02-10 10:40:54 +02:00 committed by Dirk Hohndel
parent 50424df653
commit 0dfff310de

View file

@ -378,6 +378,8 @@ void DiveGasPressureItem::paint(QPainter* painter, const QStyleOptionGraphicsIte
pen.setCosmetic(true);
pen.setWidth(2);
struct dive *d = getDiveById(dataModel->id());
if (!d)
return;
struct plot_data *entry = dataModel->data().entry;
Q_FOREACH(const QPolygonF& poly, polygons) {
for (int i = 1, count = poly.count(); i < count; i++, entry++) {