diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2024-03-16 23:39:10 +0000 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2024-03-16 23:39:10 +0000 |
commit | 5a22437d5fe2c21276e17879e5e23db271bcffdc (patch) | |
tree | 2adb6565ff0292f16830b20460155deda420e8b5 | |
parent | 83c075c72bd07747f0ad59a448ae8a4a58d9e402 (diff) | |
download | mlua-5a22437d5fe2c21276e17879e5e23db271bcffdc.zip |
Assert that `luau_compile` returns non-null pointer.
Fixes #381
-rw-r--r-- | mlua-sys/src/luau/luacode.rs | 1 |
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 |