changeset 576:414d11df07ce

Gracefully handle error situations when the main UI has not yet been initialized properly.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 30 Dec 2012 08:12:38 +0200
parents cc1c68737227
children 06675b69ca6c
files main.c ui.c
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Thu Dec 13 15:50:54 2012 +0200
+++ b/main.c	Sun Dec 30 08:12:38 2012 +0200
@@ -259,7 +259,7 @@
     nn_window_t *tmpwin = (win != NULL) ? win : nnwin_main_window();
 
     // Only the main window 
-    if (win == NULL && (flags & LOG_RECURSIVE) == 0)
+    if (win == NULL && tmpwin != NULL && (flags & LOG_RECURSIVE) == 0)
     {
         time_t currTime = time(NULL);
         struct tm *currTm, *prevTm;
--- a/ui.c	Thu Dec 13 15:50:54 2012 +0200
+++ b/ui.c	Sun Dec 30 08:12:38 2012 +0200
@@ -254,6 +254,9 @@
     const char *s = fmt;
     int col = 0;
     
+    if (win == NULL)
+        return -16;
+    
     while (*s)
     {
         if (win->line == NULL)