Skip to content

Commit debff19

Browse files
committed
Check for null local dictionaries
1 parent 9f4f689 commit debff19

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

py/objtype.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,9 @@ STATIC bool check_for_special_accessors(mp_obj_t key, mp_obj_t value) {
966966
}
967967

968968
STATIC bool map_has_special_accessors(const mp_map_t *map) {
969+
if (map == NULL) {
970+
return false;
971+
}
969972
for (size_t i = 0; i < map->alloc; i++) {
970973
if (MP_MAP_SLOT_IS_FILLED(map, i)) {
971974
const mp_map_elem_t *elem = &map->table[i];
@@ -1183,6 +1186,7 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict)
11831186
if (!(o->flags & TYPE_FLAG_HAS_SPECIAL_ACCESSORS) &&
11841187
(map_has_special_accessors(locals_map) ||
11851188
(num_native_bases == 1 &&
1189+
native_base->locals_dict != NULL &&
11861190
map_has_special_accessors(&native_base->locals_dict->map)))) {
11871191
o->flags |= TYPE_FLAG_HAS_SPECIAL_ACCESSORS;
11881192
}

0 commit comments

Comments
 (0)