Skip to content

Commit

Permalink
anvil: Avoid panicing if cursor themes with delay 0
Browse files Browse the repository at this point in the history
  • Loading branch information
bbb651 authored and Drakulix committed Feb 4, 2025
1 parent 8e54fd5 commit b4cf986
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions anvil/src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ fn nearest_images(size: u32, images: &[Image]) -> impl Iterator<Item = &Image> {

fn frame(mut millis: u32, size: u32, images: &[Image]) -> Image {
let total = nearest_images(size, images).fold(0, |acc, image| acc + image.delay);
if total == 0 {
return nearest_images(size, images).next().unwrap().clone();
}
millis %= total;

for img in nearest_images(size, images) {
Expand Down

0 comments on commit b4cf986

Please sign in to comment.