Skip to content

Commit 52bbcb1

Browse files
authored
[IL2CPP] fixed class iterator failing if the metadata handle is 0 (#122)
* [IL2CPP] fixed class iterator failing if the metadata handle is 0 Thanks to @nikoheart for discovering this, as it was causing the iterator to fail in some cases
1 parent 9af21cd commit 52bbcb1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/game_engine/unity/il2cpp/image.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ impl Image {
3838
handle => process.read::<u32>(handle).unwrap_or_default(),
3939
};
4040

41-
let type_info_definition_table = match metadata_handle {
42-
0 => Address::NULL,
41+
let type_info_definition_table = match metadata_ptr {
42+
Address::NULL => Address::NULL,
4343
_ => process
4444
.read_pointer(module.type_info_definition_table, module.pointer_size)
4545
.unwrap_or_default(),
4646
};
4747

48-
let ptr = match (metadata_handle, type_info_definition_table) {
49-
(0, _) | (_, Address::NULL) => Address::NULL,
48+
let ptr = match type_info_definition_table {
49+
Address::NULL => Address::NULL,
5050
_ => {
5151
type_info_definition_table + module.size_of_ptr().wrapping_mul(metadata_handle as _)
5252
}

0 commit comments

Comments
 (0)