diff --git a/applications/system/js_app/modules/js_widget.c b/applications/system/js_app/modules/js_widget.c index 830474d921..a27c55c1e0 100644 --- a/applications/system/js_app/modules/js_widget.c +++ b/applications/system/js_app/modules/js_widget.c @@ -917,9 +917,8 @@ static void widget_remove_view(void* context) { ComponentArray_it(it, model->component); while(!ComponentArray_end_p(it)) { WidgetComponent* component = *ComponentArray_ref(it); - if(component->free) { + if(component && component->free) { component->free(component); - component->free = NULL; } ComponentArray_next(it); } @@ -1003,6 +1002,7 @@ static void js_widget_destroy(void* inst) { view_dispatcher_stop(widget->view_dispatcher); widget_deinit(widget); } + widget_remove_view(widget); free(widget); }