Fix PVS warnings (#4277)

* Fixing PVS warns

* pvs: additional fixes

---------

Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
MMX
2025-09-24 20:00:39 +03:00
committed by GitHub
parent 5c54be4d9c
commit 30077dd512
34 changed files with 54 additions and 39 deletions

View File

@@ -93,12 +93,17 @@ static const FrameBubble*
bubble_animation_pick_bubble(BubbleAnimationViewModel* model, bool active) {
const FrameBubble* bubble = NULL;
if((model->active_bubbles == 0) && (model->passive_bubbles == 0)) {
// Check for division by zero based on the active parameter
if((active && model->active_bubbles == 0) || (!active && model->passive_bubbles == 0)) {
return NULL;
}
uint8_t index =
furi_hal_random_get() % (active ? model->active_bubbles : model->passive_bubbles);
uint8_t random_value = furi_hal_random_get();
// In case random generator return zero lets set it to 3
if(random_value == 0) {
random_value = 3;
}
uint8_t index = random_value % (active ? model->active_bubbles : model->passive_bubbles);
const BubbleAnimation* animation = model->current;
for(int i = 0; i < animation->frame_bubble_sequences_count; ++i) {