It just leaves ugly blank areas, but whatever.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
struct tm *tm;
char buffer[80];
+ if (!dive) {
+ gtk_entry_set_text(GTK_ENTRY(datetime), "no dive");
+ gtk_entry_set_text(GTK_ENTRY(depth), "");
+ gtk_entry_set_text(GTK_ENTRY(duration), "");
+ return;
+ }
+
tm = gmtime(&dive->when);
snprintf(buffer, sizeof(buffer),
"%04d-%02d-%02d "
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;
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);