summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-10-18 22:37:28 +0800
committerruki <[email protected]>2025-10-18 22:37:28 +0800
commit68cc4f4b0f271a01d8ea68291537529358332d20 (patch)
treeb69613ec014766c8e7ec2734118b0d8f9b6ab653
parentc3c6731404b9e28915ac10b79c6cc6ad6ecc1996 (diff)
fix check data
-rw-r--r--core/src/xmake/io/file_read.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/src/xmake/io/file_read.c b/core/src/xmake/io/file_read.c
index ecbb04dbd..1c3af6dfe 100644
--- a/core/src/xmake/io/file_read.c
+++ b/core/src/xmake/io/file_read.c
@@ -185,7 +185,11 @@ static tb_int_t xm_io_file_read_all_directly(lua_State* lua, xm_io_file_t* file)
xm_io_return_error(lua, "init buffer failed!");
tb_byte_t* data = tb_buffer_resize(&file->rcache, XM_IO_BLOCK_MAXN);
- tb_assert(data);
+ if (!data)
+ {
+ tb_buffer_exit(&buf);
+ xm_io_return_error(lua, "out of memory: failed to resize read cache");
+ }
// read all
tb_stream_ref_t stream = file->u.file_ref;