diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-11 22:52:02 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-12 06:36:41 -0700 |
commit | d62d1124cfed290a8f9c0cc8d5c4a83de5308e84 (patch) | |
tree | 6ef17afb3116d1d6b9806a9f214050326a0523cc /qt-ui | |
parent | 5105d6a33316e87fe59652c461df8ad7ca07fb0e (diff) | |
download | subsurface-d62d1124cfed290a8f9c0cc8d5c4a83de5308e84.tar.gz |
Fix crash if we have no divecomputer information
The string we print is lame, but it keeps things consistent (and prevents
us from dereferencing functions in uninitialized objects).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profilegraphics.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index d606d8260..54b0df8b1 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -311,10 +311,11 @@ void ProfileGraphicsView::plot(struct dive *d) if (nick.isEmpty()) nick = QString(dc->model); - if (!nick.isEmpty()) { - text_render_options_t computer = {DC_TEXT_SIZE, TIME_TEXT, LEFT, MIDDLE}; - diveComputer = plot_text(&computer, QPointF(gc.leftx, gc.bottomy), nick); - } + if (nick.isEmpty()) + nick = tr("unknown divecomputer"); + + text_render_options_t computer = {DC_TEXT_SIZE, TIME_TEXT, LEFT, MIDDLE}; + diveComputer = plot_text(&computer, QPointF(gc.leftx, gc.bottomy), nick); // The Time ruler should be right after the DiveComputer: timeMarkers->setPos(0, diveComputer->y()); |