Check that Lua state is non-null in init_from_ptr()
This commit is contained in:
parent
ee32dc33f3
commit
5330b900fd
|
@ -497,6 +497,7 @@ impl Lua {
|
||||||
/// by calling this function again.
|
/// by calling this function again.
|
||||||
#[allow(clippy::missing_safety_doc)]
|
#[allow(clippy::missing_safety_doc)]
|
||||||
pub unsafe fn init_from_ptr(state: *mut ffi::lua_State) -> Lua {
|
pub unsafe fn init_from_ptr(state: *mut ffi::lua_State) -> Lua {
|
||||||
|
assert!(!state.is_null(), "Lua state is NULL");
|
||||||
let main_state = get_main_state(state).unwrap_or(state);
|
let main_state = get_main_state(state).unwrap_or(state);
|
||||||
let main_state_top = ffi::lua_gettop(main_state);
|
let main_state_top = ffi::lua_gettop(main_state);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue