Temp fix menu edge case crash in esubghz chat

This commit is contained in:
Willy-JL
2024-04-19 08:28:40 +01:00
parent c4c1870875
commit a2fc553bef
2 changed files with 9 additions and 4 deletions

View File

@@ -70,7 +70,7 @@ uint8_t icon_animation_get_height(const IconAnimation* instance) {
void icon_animation_start(IconAnimation* instance) { void icon_animation_start(IconAnimation* instance) {
furi_check(instance); furi_check(instance);
if(!instance->animating && instance->icon->frame_rate && instance->icon->frame_count > 1) { if(!instance->animating) {
instance->animating = true; instance->animating = true;
furi_assert(instance->icon->frame_rate); furi_assert(instance->icon->frame_rate);
furi_check( furi_check(

View File

@@ -498,9 +498,14 @@ static void menu_exit(void* context) {
menu->view, menu->view,
MenuModel * model, MenuModel * model,
{ {
MenuItem* item = MenuItemArray_get(model->items, model->position); // If menu_reset() is called before view exit, model->items is reset
if(item && item->icon) { // But for some reason, even with size 0, array get() returns a non-null pointer?
icon_animation_stop(item->icon); // MLIB docs have no mention of out of bounds condition, seems weird
if(model->position < MenuItemArray_size(model->items)) {
MenuItem* item = MenuItemArray_get(model->items, model->position);
if(item && item->icon) {
icon_animation_stop(item->icon);
}
} }
}, },
false); false);