Skip to content

Commit

Permalink
Throw out of index error in struct:field method (lune-org#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwreey committed Nov 9, 2024
1 parent 230632b commit b191218
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/lune-std-ffi/src/c/struct_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ impl LuaUserData for CStructInfo {
"field",
|lua, (this, field_index): (LuaAnyUserData, usize)| {
let field_table = get_field_table(lua, &this)?;
field_table.raw_get::<_, LuaAnyUserData>(field_index + 1)
field_table
.raw_get::<_, Option<LuaAnyUserData>>(field_index + 1)?
.ok_or_else(|| LuaError::external("Out of index"))
},
);
}
Expand Down

0 comments on commit b191218

Please sign in to comment.