summaryrefslogtreecommitdiffstats
path: root/info.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 /info.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 'info.c')
-rw-r--r--info.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/info.c b/info.c
index efd17f896..bef3f1dba 100644
--- a/info.c
+++ b/info.c
@@ -12,6 +12,13 @@ void update_dive_info(struct dive *dive)
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 "