Browse Source

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

default 2 months ago
parent
commit
be9104783e
1 changed files with 2 additions and 1 deletions
  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) {
             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')
                 break;