Browse Source

lsp_mg_read: remove dead code, return nil on empty read

abadc0de 12 năm trước cách đây
mục cha
commit
ce55924a02
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      mongoose.c

+ 1 - 1
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;