mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
c4c7d85fb5
commit
f4a2ce1017
1 changed files with 2 additions and 1 deletions
|
@ -56,6 +56,8 @@ QColor DiveCartesianAxis::colorForValue(double value)
|
||||||
|
|
||||||
void DiveCartesianAxis::updateTicks()
|
void DiveCartesianAxis::updateTicks()
|
||||||
{
|
{
|
||||||
|
if (!scene())
|
||||||
|
return;
|
||||||
QLineF m = line();
|
QLineF m = line();
|
||||||
// unused so far:
|
// unused so far:
|
||||||
// QGraphicsView *view = scene()->views().first();
|
// QGraphicsView *view = scene()->views().first();
|
||||||
|
@ -124,7 +126,6 @@ void DiveCartesianAxis::updateTicks()
|
||||||
}
|
}
|
||||||
labels.push_back(label);
|
labels.push_back(label);
|
||||||
if (orientation == RightToLeft || orientation == LeftToRight) {
|
if (orientation == RightToLeft || orientation == LeftToRight) {
|
||||||
|
|
||||||
if(showText){
|
if(showText){
|
||||||
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
|
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
|
||||||
label->setPos(scene()->sceneRect().width() + 10, m.y1() + tickSize); // position it outside of the scene);
|
label->setPos(scene()->sceneRect().width() + 10, m.y1() + tickSize); // position it outside of the scene);
|
||||||
|
|
Loading…
Add table
Reference in a new issue