esp32/machine_pin: Fix null pointer access in machine_pin_find.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
iabdalkader 2023-09-11 16:17:43 +02:00 committed by Damien George
parent 92f379cce4
commit 7087880ce9

View File

@ -113,7 +113,7 @@ STATIC const machine_pin_obj_t *machine_pin_find(mp_obj_t pin_in) {
// Try to find the pin in the board pins dict. // Try to find the pin in the board pins dict.
if (mp_obj_is_str(pin_in)) { if (mp_obj_is_str(pin_in)) {
const machine_pin_obj_t *self = machine_pin_find_named(&machine_pin_board_pins_locals_dict, pin_in); const machine_pin_obj_t *self = machine_pin_find_named(&machine_pin_board_pins_locals_dict, pin_in);
if (self->base.type != NULL) { if (self && self->base.type != NULL) {
return self; return self;
} }
} }