From http://www.jwz.org/xscreensaver/xscreensaver-5.27.tar.gz
[xscreensaver] / hacks / xmatrix.c
index ba467049c5ba3f61b8a5428a5268deb73cdb6271..4f88d8d895ef4e95407ff2a765e1a3b3dc73b225 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1999-2012 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1999-2013 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -335,11 +335,13 @@ fill_input (m_state *s)
   if (!s->tc)
     return;
 
-  if (loadBytes > 0){
-    char c = textclient_getc (s->tc);
-    n = (c > 0 ? 1 : -1);
-    s->buf [s->buf_pos] = c;
-  }
+  if (loadBytes > 0)
+    {
+      int c = textclient_getc (s->tc);
+      n = (c > 0 ? 1 : -1);
+      s->buf [s->buf_pos] = (char) c;
+    }
+
   if (n > 0)
     {
         s->do_fill_buff = False;
@@ -1341,7 +1343,7 @@ hack_text (m_state *state)
 
     AGAIN:
       c  = ((unsigned char *) state->typing)[0];
-      c1 = ((unsigned char *) state->typing)[1];
+      c1 = c ? ((unsigned char *) state->typing)[1] : 0;
 
       state->typing_delay = (!c || c1 == '\n'
                              ? state->typing_line_delay