summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Orlenko <zxteam@protonmail.com>2024-03-16 23:39:10 +0000
committerAlex Orlenko <zxteam@protonmail.com>2024-03-16 23:39:10 +0000
commit5a22437d5fe2c21276e17879e5e23db271bcffdc (patch)
tree2adb6565ff0292f16830b20460155deda420e8b5
parent83c075c72bd07747f0ad59a448ae8a4a58d9e402 (diff)
downloadmlua-5a22437d5fe2c21276e17879e5e23db271bcffdc.zip
Assert that `luau_compile` returns non-null pointer.
Fixes #381
-rw-r--r--mlua-sys/src/luau/luacode.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/mlua-sys/src/luau/luacode.rs b/mlua-sys/src/luau/luacode.rs
index ae90e50..357ad25 100644
--- a/mlua-sys/src/luau/luacode.rs
+++ b/mlua-sys/src/luau/luacode.rs
@@ -36,6 +36,7 @@ pub unsafe fn luau_compile(source: &[u8], mut options: lua_CompileOptions) -> Ve
&mut options,
&mut outsize,
);
+ assert!(!data_ptr.is_null(), "luau_compile failed");
let data = slice::from_raw_parts(data_ptr as *mut u8, outsize).to_vec();
free(data_ptr as *mut c_void);
data