diff options
-rw-r--r-- | liolib.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.70 2005/12/29 15:32:11 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.71 2006/01/17 13:54:02 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -283,7 +283,7 @@ static int read_line (lua_State *L, FILE *f) { | |||
283 | return (lua_strlen(L, -1) > 0); /* check whether read something */ | 283 | return (lua_strlen(L, -1) > 0); /* check whether read something */ |
284 | } | 284 | } |
285 | l = strlen(p); | 285 | l = strlen(p); |
286 | if (p[l-1] != '\n') | 286 | if (l == 0 || p[l-1] != '\n') |
287 | luaL_addsize(&b, l); | 287 | luaL_addsize(&b, l); |
288 | else { | 288 | else { |
289 | luaL_addsize(&b, l - 1); /* do not include `eol' */ | 289 | luaL_addsize(&b, l - 1); /* do not include `eol' */ |