From: andy Date: Wed, 15 Mar 2006 19:35:30 +0000 (+0000) Subject: Melchior found the first bug -- report EOF as nil in readln(). X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=29eb5664483883863fd6b72340b55b1c71e13b83;p=simgear.git Melchior found the first bug -- report EOF as nil in readln(). --- diff --git a/simgear/nasal/iolib.c b/simgear/nasal/iolib.c index 9d65fa1e..d90654b6 100644 --- a/simgear/nasal/iolib.c +++ b/simgear/nasal/iolib.c @@ -174,7 +174,7 @@ static naRef f_readln(naContext ctx, naRef me, int argc, naRef* args) buf[i++] = c; if(i >= sz) buf = naRealloc(buf, sz *= 2); } - result = naStr_fromdata(naNewString(ctx), buf, i); + result = c == EOF ? naNil() : naStr_fromdata(naNewString(ctx), buf, i); naFree(buf); return result; }