summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-25 07:25:03 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-25 07:25:03 -0800
commitf4a2ce101729ff9178c90adbaf6777e3b2cafa7b (patch)
tree8c437e9c815d48d96975de6878c4ca054094716a /qt-ui
parentc4c7d85fb5b810ad46ec179c25e54ea609b77a02 (diff)
downloadsubsurface-f4a2ce101729ff9178c90adbaf6777e3b2cafa7b.tar.gz
Fix potential crash at startup
Strangely enough, on the system I build this, I don't see the crash. But when I create a DMG and run it on a different Mac, it crashes if updateTicks() is called but scene() still returns 0. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index 8a1b1890d..feeaf12b8 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -56,6 +56,8 @@ QColor DiveCartesianAxis::colorForValue(double value)
void DiveCartesianAxis::updateTicks()
{
+ if (!scene())
+ return;
QLineF m = line();
// unused so far:
// QGraphicsView *view = scene()->views().first();
@@ -124,7 +126,6 @@ void DiveCartesianAxis::updateTicks()
}
labels.push_back(label);
if (orientation == RightToLeft || orientation == LeftToRight) {
-
if(showText){
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
label->setPos(scene()->sceneRect().width() + 10, m.y1() + tickSize); // position it outside of the scene);