summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/diveprofileitem.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2014-02-10 10:40:54 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-10 07:06:37 -0800
commit0dfff310de4616f4d378ee91641dd641c77fd6b3 (patch)
tree3fa81b8e21a0f541fe98434ebb870ceedad84d84 /qt-ui/profile/diveprofileitem.cpp
parent50424df65311d2226bc4f221b9c2f3fa5d965ed3 (diff)
downloadsubsurface-0dfff310de4616f4d378ee91641dd641c77fd6b3.tar.gz
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>
Diffstat (limited to 'qt-ui/profile/diveprofileitem.cpp')
-rw-r--r--qt-ui/profile/diveprofileitem.cpp2
1 files changed, 2 insertions, 0 deletions
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++) {