Skip to content

Commit 06148b7

Browse files
committed
Fix item_get_keys
Closes #83
1 parent d9c78a7 commit 06148b7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/game/item.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,8 +1609,11 @@ int item_get_keys(int64_t obj, int* key_ids)
16091609
}
16101610

16111611
cnt = obj_arrayfield_length_get(obj, OBJ_F_KEY_RING_LIST_IDX);
1612-
for (index = 0; index < cnt; index++) {
1613-
key_ids[index] = obj_arrayfield_uint32_get(obj, OBJ_F_KEY_RING_LIST_IDX, index);
1612+
1613+
if (key_ids != NULL) {
1614+
for (index = 0; index < cnt; index++) {
1615+
key_ids[index] = obj_arrayfield_uint32_get(obj, OBJ_F_KEY_RING_LIST_IDX, index);
1616+
}
16141617
}
16151618

16161619
return cnt;

0 commit comments

Comments
 (0)