diff options
| author | microDev <70126934+microDev1@users.noreply.github.com> | 2020-11-19 11:44:22 +0530 |
|---|---|---|
| committer | microDev <70126934+microDev1@users.noreply.github.com> | 2020-11-19 11:44:22 +0530 |
| commit | b56645808c88cca22a42cb66ed7b3ddc8383436a (patch) | |
| tree | 983e5d3b929585fec0d847e3bc48338eb47c1987 /shared-bindings | |
| parent | 0d3e81f969adc6d8744e8e720ec4b01848a8fa6c (diff) | |
fix crash on user code exit
Diffstat (limited to 'shared-bindings')
| -rw-r--r-- | shared-bindings/ps2io/Ps2.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/shared-bindings/ps2io/Ps2.c b/shared-bindings/ps2io/Ps2.c index 0977e08ff..07fa5cebb 100644 --- a/shared-bindings/ps2io/Ps2.c +++ b/shared-bindings/ps2io/Ps2.c @@ -116,8 +116,9 @@ STATIC void check_for_deinit(ps2io_ps2_obj_t *self) { //| ... //| STATIC mp_obj_t ps2io_ps2_obj___exit__(size_t n_args, const mp_obj_t *args) { - (void)n_args; - common_hal_ps2io_ps2_deinit(args[0]); + mp_check_self(MP_OBJ_IS_TYPE(args[0], &ps2io_ps2_type)); + ps2io_ps2_obj_t *self = MP_OBJ_TO_PTR(args[0]); + common_hal_ps2io_ps2_deinit(self); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ps2io_ps2___exit___obj, 4, 4, ps2io_ps2_obj___exit__); |
