Don't dispose whole traceback when it's not utf-8

This commit is contained in:
Jonas Schievink 2017-08-01 23:38:12 +02:00
parent 38a13c906e
commit ed6e7ed5e7
1 changed files with 1 additions and 2 deletions

View File

@ -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,