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>
This commit is contained in:
Dirk Hohndel 2013-05-11 22:52:02 -07:00
parent 5105d6a333
commit d62d1124cf

View file

@ -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());