aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-27 16:21:13 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-28 11:29:29 -0800
commit7a07665d89aa26d37a8aa8defd20cbe1a569c874 (patch)
tree495b4759f1a9f704ee8367b0e37cf197b18f020f /qt-ui/profile
parentfcc17c717dd0b380803fcbe161376df141b86c61 (diff)
downloadsubsurface-7a07665d89aa26d37a8aa8defd20cbe1a569c874.tar.gz
Do not create label if string is empty.
Do not create a text label if the returned string is empty. Also, fixed a potential crash after not creating a label and adding it to the list of created labels. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index b1586f992..7a58e3bb4 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -121,12 +121,15 @@ void DiveCartesianAxis::updateTicks()
DiveTextItem *label = NULL;
if (showText){
+ QString text = textForValue(currValue);
+ if(text.isEmpty())
+ continue; // Do not create or do anything with an empty string.
label = new DiveTextItem(this);
label->setText(textForValue(currValue));
label->setBrush(QBrush(textColor));
label->setBrush(colorForValue(currValue));
+ labels.push_back(label);
}
- labels.push_back(label);
if (orientation == RightToLeft || orientation == LeftToRight) {
if(showText){
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);