From 0dfff310de4616f4d378ee91641dd641c77fd6b3 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Mon, 10 Feb 2014 10:40:54 +0200 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveprofileitem.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index 214fd1e12..96947bd02 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -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++) { -- cgit v1.2.3-70-g09d2