diff options
| author | Lucian Copeland <hierophect@gmail.com> | 2020-08-05 14:05:53 -0400 |
|---|---|---|
| committer | Lucian Copeland <hierophect@gmail.com> | 2020-08-05 14:05:53 -0400 |
| commit | 78d049d0f14206d653b89c8cdcc91199954858c1 (patch) | |
| tree | b7a50e39755a0c82bb48a74aaced0783a16f2307 /supervisor | |
| parent | 14b3b51c58ca368227d8890a2aa32e7acb94175b (diff) | |
Fix pwm reset spew, protect against null reference in led status
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/rgb_led_status.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index 1de745a56..b66bbd9d5 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -387,20 +387,22 @@ void prep_rgb_status_animation(const pyexec_result_t* result, if (!status->ok) { status->total_exception_cycle = EXCEPTION_TYPE_LENGTH_MS * 3 + LINE_NUMBER_TOGGLE_LENGTH * status->digit_sum + LINE_NUMBER_TOGGLE_LENGTH * num_places; } - if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_IndentationError)) { - status->exception_color = INDENTATION_ERROR; - } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_SyntaxError)) { - status->exception_color = SYNTAX_ERROR; - } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_NameError)) { - status->exception_color = NAME_ERROR; - } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_OSError)) { - status->exception_color = OS_ERROR; - } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_ValueError)) { - status->exception_color = VALUE_ERROR; - } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_MpyError)) { - status->exception_color = MPY_ERROR; - } else { - status->exception_color = OTHER_ERROR; + if (result->exception_type) { + if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_IndentationError)) { + status->exception_color = INDENTATION_ERROR; + } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_SyntaxError)) { + status->exception_color = SYNTAX_ERROR; + } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_NameError)) { + status->exception_color = NAME_ERROR; + } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_OSError)) { + status->exception_color = OS_ERROR; + } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_ValueError)) { + status->exception_color = VALUE_ERROR; + } else if (mp_obj_is_subclass_fast(result->exception_type, &mp_type_MpyError)) { + status->exception_color = MPY_ERROR; + } else { + status->exception_color = OTHER_ERROR; + } } #endif } |
