more hard to trigger bugs that I noticed doing conversion
This commit is contained in:
parent
bb2a9c5b5d
commit
b07557c1c7
|
@ -314,11 +314,14 @@ where
|
||||||
pub unsafe extern "C" fn error_traceback(state: *mut ffi::lua_State) -> c_int {
|
pub unsafe extern "C" fn error_traceback(state: *mut ffi::lua_State) -> c_int {
|
||||||
ffi::luaL_checkstack(state, 2, ptr::null());
|
ffi::luaL_checkstack(state, 2, ptr::null());
|
||||||
|
|
||||||
if let Some(error) = pop_wrapped_error(state) {
|
if is_wrapped_error(state, 1) {
|
||||||
ffi::luaL_traceback(state, state, ptr::null(), 0);
|
ffi::luaL_traceback(state, state, ptr::null(), 0);
|
||||||
let traceback = CStr::from_ptr(ffi::lua_tostring(state, -1))
|
let traceback = CStr::from_ptr(ffi::lua_tostring(state, -1))
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.into_owned();
|
.into_owned();
|
||||||
|
ffi::lua_pop(state, 1);
|
||||||
|
|
||||||
|
let error = pop_wrapped_error(state).unwrap();
|
||||||
push_wrapped_error(
|
push_wrapped_error(
|
||||||
state,
|
state,
|
||||||
Error::CallbackError {
|
Error::CallbackError {
|
||||||
|
@ -326,7 +329,6 @@ pub unsafe extern "C" fn error_traceback(state: *mut ffi::lua_State) -> c_int {
|
||||||
cause: Arc::new(error),
|
cause: Arc::new(error),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
ffi::lua_remove(state, -2);
|
|
||||||
} else if !is_wrapped_panic(state, 1) {
|
} else if !is_wrapped_panic(state, 1) {
|
||||||
let s = ffi::lua_tostring(state, 1);
|
let s = ffi::lua_tostring(state, 1);
|
||||||
let s = if s.is_null() {
|
let s = if s.is_null() {
|
||||||
|
|
Loading…
Reference in New Issue