From d62d1124cfed290a8f9c0cc8d5c4a83de5308e84 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 11 May 2013 22:52:02 -0700 Subject: [PATCH] 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 --- qt-ui/profilegraphics.cpp | 9 +++++---- 1 file 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());