Przeglądaj źródła

Don't append non-strings in xs_readline().

default 1 rok temu
rodzic
commit
be9104783e
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      xs_io.h

+ 2 - 1
xs_io.h

@@ -27,7 +27,8 @@ xs_str *xs_readline(FILE *f)
         while ((c = fgetc(f)) != EOF) {
         while ((c = fgetc(f)) != EOF) {
             unsigned char rc = c;
             unsigned char rc = c;
 
 
-            s = xs_append_m(s, (char *)&rc, 1);
+            if (xs_is_string((char *)&rc))
+                s = xs_append_m(s, (char *)&rc, 1);
 
 
             if (c == '\n')
             if (c == '\n')
                 break;
                 break;