summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-08-31 16:40:22 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-08-31 16:40:22 -0700
commit968aa28155b3a55b558d16e3a46dfd5c887dc3c6 (patch)
treedd3c18e4da2799773a4dcb9df521e916556e6b13 /profile.c
parent00d798854aa2594b819f50dc135efca96a93adb9 (diff)
downloadsubsurface-968aa28155b3a55b558d16e3a46dfd5c887dc3c6.tar.gz
Do something half-way sane (no SIGSEGV) when there are no dives
It just leaves ugly blank areas, but whatever. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/profile.c b/profile.c
index f898be745..9d84ff29d 100644
--- a/profile.c
+++ b/profile.c
@@ -100,7 +100,7 @@ static void plot(cairo_t *cr, int w, int h, struct dive *dive, int samples, stru
static gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
- struct dive *dive = dive_table.dives[selected_dive];
+ struct dive *dive = current_dive;
cairo_t *cr;
int w,h;
@@ -111,7 +111,7 @@ static gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer
cairo_set_source_rgb(cr, 0, 0, 0);
cairo_paint(cr);
- if (dive->samples)
+ if (dive && dive->samples)
plot(cr, w, h, dive, dive->samples, dive->sample);
cairo_destroy(cr);