From c74b286e70cbd2d46eac676c192f53f7491f8d85 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 9 Oct 2013 00:15:46 -0700 Subject: [PATCH] Fix potential uninitialized variable Most of the "possibly unitialized" warnings are bogus, but this one is a potential real bug. Signed-off-by: Dirk Hohndel --- qt-ui/profilegraphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 9973af101..30adef132 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -217,7 +217,7 @@ QColor ProfileGraphicsView::getColor(const color_indice_t i) void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw) { - struct divecomputer *dc; + struct divecomputer *dc = NULL; if (d) dc = select_dc(&d->dc); @@ -247,7 +247,7 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw) // Fix this for printing / screen later. // plot_set_scale(scale_mode_t); - if (!dc->samples) { + if (!dc || !dc->samples) { dc = fake_dc(dc); }