Don't dispose whole traceback when it's not utf-8
This commit is contained in:
parent
38a13c906e
commit
ed6e7ed5e7
|
@ -376,8 +376,7 @@ pub unsafe fn pcall_with_traceback(
|
||||||
if let Some(error) = pop_wrapped_error(state) {
|
if let Some(error) = pop_wrapped_error(state) {
|
||||||
ffi::luaL_traceback(state, state, ptr::null(), 0);
|
ffi::luaL_traceback(state, state, ptr::null(), 0);
|
||||||
let traceback = CStr::from_ptr(ffi::lua_tolstring(state, -1, ptr::null_mut()))
|
let traceback = CStr::from_ptr(ffi::lua_tolstring(state, -1, ptr::null_mut()))
|
||||||
.to_str()
|
.to_string_lossy()
|
||||||
.unwrap_or_else(|_| "<could not capture traceback>")
|
|
||||||
.to_owned();
|
.to_owned();
|
||||||
push_wrapped_error(state, Error::CallbackError {
|
push_wrapped_error(state, Error::CallbackError {
|
||||||
traceback,
|
traceback,
|
||||||
|
|
Loading…
Reference in New Issue