Browse Source

fix:zbuff:resize(0)死机

alienwalker 2 years ago
parent
commit
4d34c91046
1 changed files with 1 additions and 1 deletions
  1. 1 1
      luat/modules/luat_lib_zbuff.c

+ 1 - 1
luat/modules/luat_lib_zbuff.c

@@ -1019,7 +1019,7 @@ static int l_zbuff_gc(lua_State *L)
 
 int __zbuff_resize(luat_zbuff_t *buff, uint32_t new_size)
 {
-	void *p = luat_heap_opt_realloc(buff->type, buff->addr, new_size);
+	void *p = luat_heap_opt_realloc(buff->type, buff->addr, new_size?new_size:1);
 	if (p)
 	{
 		buff->addr = p;