Fix sonarcloud bugs

This commit is contained in:
Willy-JL
2023-01-20 21:14:59 +00:00
parent 36a2a6ef34
commit 88eb98dd9e
3 changed files with 24 additions and 29 deletions

View File

@@ -407,7 +407,7 @@ static StorageAnimation*
}
}
uint32_t lucky_number = furi_hal_random_get() % whole_weight;
uint32_t lucky_number = furi_hal_random_get() % (whole_weight != 0 ? whole_weight : 1);
uint32_t weight = 0;
StorageAnimation* selected = NULL;

View File

@@ -32,23 +32,24 @@ static BubbleAnimation* animation_storage_load_animation(const char* name);
void animation_handler_select_manifest() {
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
FuriString* anim_dir = furi_string_alloc();
if (xtreme_settings->asset_pack[0] != '\0') {
snprintf(ANIMATION_DIR, sizeof(PACKS_DIR), "%s", PACKS_DIR);
furi_string_printf(anim_dir, "%s/%s/Anims", PACKS_DIR, xtreme_settings->asset_pack);
FURI_LOG_I(TAG, "Custom Manifest selected");
strcat(ANIMATION_DIR, "/");
strcat(ANIMATION_DIR, xtreme_settings->asset_pack);
strcat(ANIMATION_DIR, "/Anims");
} else {
snprintf(ANIMATION_DIR, sizeof(BASE_ANIMATION_DIR), "%s", BASE_ANIMATION_DIR);
furi_string_cat_str(anim_dir, BASE_ANIMATION_DIR);
if(xtreme_settings->sfw_mode) {
furi_string_cat_str(anim_dir, "/sfw");
FURI_LOG_I(TAG, "SFW Manifest selected");
strcat(ANIMATION_DIR, "/sfw");
} else {
furi_string_cat_str(anim_dir, "/nsfw");
FURI_LOG_I(TAG, "NSFW Manifest selected");
strcat(ANIMATION_DIR, "/nsfw");
}
}
snprintf(ANIMATION_MANIFEST_FILE, sizeof(ANIMATION_MANIFEST_FILE), "%s/manifest.txt", ANIMATION_DIR);
strlcpy(ANIMATION_DIR, furi_string_get_cstr(anim_dir), sizeof(ANIMATION_DIR));
furi_string_cat_str(anim_dir, "/manifest.txt");
strlcpy(ANIMATION_MANIFEST_FILE, furi_string_get_cstr(anim_dir), sizeof(ANIMATION_MANIFEST_FILE));
furi_string_free(anim_dir);
}
static bool animation_storage_load_single_manifest_info(