Skip to content

Commit f5d710f

Browse files
fix: Guard against zero framesCount to avoid modulo by zero in SnowFlakeAnimation
1 parent 90a491f commit f5d710f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/badge_animation/ani_snowflake.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ class SnowFlakeAnimation extends BadgeAnimation {
88
int newGridWidth = processGrid[0].length;
99

1010
int framesCount = (newGridWidth / badgeWidth).ceil();
11+
framesCount = framesCount == 0 ? 1 : framesCount;
1112

1213
int currentFrame = animationIndex % framesCount;
13-
1414
int startCol = currentFrame * badgeWidth;
1515

1616
for (int i = 0; i < badgeHeight; i++) {
@@ -20,4 +20,4 @@ class SnowFlakeAnimation extends BadgeAnimation {
2020
}
2121
}
2222
}
23-
}
23+
}

0 commit comments

Comments
 (0)