diff ui.c @ 535:379e361f1144

Fix various segfault issues.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 14 Aug 2012 02:17:03 +0300
parents 436e86afa70a
children 658c188101a6
line wrap: on
line diff
--- a/ui.c	Thu Jun 07 03:16:56 2012 +0300
+++ b/ui.c	Tue Aug 14 02:17:03 2012 +0300
@@ -403,10 +403,10 @@
             " %s | %s | #%06x | WIN: %d: %s / %d | ",
             tmpStamp,
             username != NULL ? username : "-",
-            usercolor, 
-            currWin->num + 1,
-            currWin->id != NULL ? currWin->id : "MAIN",
-            currWin->pos);
+            usercolor,
+            currWin != NULL ? currWin->num + 1 : 0,
+            (currWin != NULL && currWin->id != NULL) ? currWin->id : "MAIN",
+            currWin != NULL ? currWin->pos : 0);
 #endif
         
         wmove(stdscr, scrHeight - 4, 0);
@@ -428,7 +428,7 @@
     wmove(stdscr, sy, sx);
 
     // Update editbuf if needed
-    if (ebuf != NULL && (force || ebuf->dirty))
+    if (cursesInit && ebuf != NULL && (force || ebuf->dirty))
     {
         int yoffs = ebuf->pos / scrWidth,
             xoffs = ebuf->pos % scrWidth;