소스 검색

Merge pull request #131 from abadc0de/lua_read_fixup

lsp_mg_read: remove dead code, return nil on empty read
Sergey Lyubka 12 년 전
부모
커밋
9b76d60b38
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      mongoose.c

+ 1 - 1
mongoose.c

@@ -4104,7 +4104,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;