diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2022-08-23 11:35:08 +0100 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2022-08-23 11:35:08 +0100 |
commit | 33278d4a64addd0b1bcdd0cd11b7f3ba9c618b28 (patch) | |
tree | ac07ea8fd9e4a8cc48c2ad54fd123d2917697d2f /src | |
parent | 20a16839aa07c29aacc17871d12fe1b397c2bab8 (diff) | |
download | mlua-33278d4a64addd0b1bcdd0cd11b7f3ba9c618b28.zip |
Check if chunk is empty in luaL_loadbufferx for Luau (fixes #200)
Diffstat (limited to 'src')
-rw-r--r-- | src/ffi/luau/compat.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ffi/luau/compat.rs b/src/ffi/luau/compat.rs index 117d1d5..c718214 100644 --- a/src/ffi/luau/compat.rs +++ b/src/ffi/luau/compat.rs @@ -341,7 +341,7 @@ pub unsafe fn luaL_loadbufferx( fn free(p: *mut c_void); } - let chunk_is_text = (*data as u8) >= b'\n'; + let chunk_is_text = size == 0 || (*data as u8) >= b'\n'; if !mode.is_null() { let modeb = CStr::from_ptr(mode).to_bytes(); if !chunk_is_text && !modeb.contains(&b'b') { |