From ce55924a0239ac00988e73eb59a5879b6b79ea5f Mon Sep 17 00:00:00 2001 From: abadc0de <abadc0de> Date: Sun, 17 Mar 2013 23:33:02 -0400 Subject: [PATCH] lsp_mg_read: remove dead code, return nil on empty read --- mongoose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index 2364c28ae..781b007d6 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4070,7 +4070,7 @@ static int lsp_mg_read(lua_State *L) { char buf[1024]; int len = mg_read(conn, buf, sizeof(buf)); - lua_settop(L, 0); + if (!len) return 0; lua_pushlstring(L, buf, len); return 1; -- GitLab