Skip to content

Commit

Permalink
popping an Object with an empty stack returns Object::nil()
Browse files Browse the repository at this point in the history
  • Loading branch information
noib3 committed Sep 10, 2023
1 parent 20b11d9 commit b3aabb2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/oxi-types/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@ impl Pushable for Object {

impl Poppable for Object {
unsafe fn pop(lstate: *mut lua_State) -> Result<Self, lua::Error> {
if lua_gettop(lstate) == 0 {
return Ok(Self::nil());
}

match lua_type(lstate, -1) {
LUA_TNIL => <()>::pop(lstate).map(Into::into),

Expand Down

0 comments on commit b3aabb2

Please sign in to comment.