Temp fix crash by bad manifest

This commit is contained in:
Willy-JL
2023-02-14 03:47:02 +00:00
parent a231ec0bbb
commit 4111070d1c

View File

@@ -372,11 +372,11 @@ static bool animation_manager_is_valid_idle_animation(
static StorageAnimation* static StorageAnimation*
animation_manager_select_idle_animation(AnimationManager* animation_manager) { animation_manager_select_idle_animation(AnimationManager* animation_manager) {
const char* old_animation_name = NULL; // const char* avoid_animation = NULL;
if(animation_manager->current_animation) { // if(animation_manager->current_animation) {
old_animation_name = // avoid_animation = animation_storage_get_meta(animation_manager->current_animation)->name;
animation_storage_get_meta(animation_manager->current_animation)->name; // }
} UNUSED(animation_manager);
StorageAnimationList_t animation_list; StorageAnimationList_t animation_list;
StorageAnimationList_init(animation_list); StorageAnimationList_init(animation_list);
@@ -385,6 +385,7 @@ static StorageAnimation*
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN); Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
DolphinStats stats = dolphin_stats(dolphin); DolphinStats stats = dolphin_stats(dolphin);
furi_record_close(RECORD_DOLPHIN); furi_record_close(RECORD_DOLPHIN);
// avoid_animation = StorageAnimationList_size(animation_list) > 1 ? avoid_animation : NULL;
uint32_t whole_weight = 0; uint32_t whole_weight = 0;
StorageAnimationList_it_t it; StorageAnimationList_it_t it;
@@ -395,11 +396,14 @@ static StorageAnimation*
animation_storage_get_meta(storage_animation); animation_storage_get_meta(storage_animation);
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats, unlock); bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats, unlock);
if(old_animation_name != NULL) { // Avoid repeating animation
if(strcmp(manifest_info->name, old_animation_name) == 0) { // Bad / empty manifests can crash flipper and (very rarely) require DFU
valid = false; // Need better solution, disabled for now
} // if(avoid_animation != NULL) {
} // if(strcmp(manifest_info->name, avoid_animation) == 0) {
// valid = false;
// }
// }
if(valid) { if(valid) {
whole_weight += manifest_info->weight; whole_weight += manifest_info->weight;