render/cursor: Don't crash for themes with zero delay
This commit is contained in:
parent
da9af7ad23
commit
16691581ff
1 changed files with 7 additions and 2 deletions
|
|
@ -115,10 +115,15 @@ 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);
|
||||
millis %= total;
|
||||
|
||||
if total == 0 {
|
||||
millis = 0;
|
||||
} else {
|
||||
millis %= total;
|
||||
}
|
||||
|
||||
for img in nearest_images(size, images) {
|
||||
if millis < img.delay {
|
||||
if millis <= img.delay {
|
||||
return img.clone();
|
||||
}
|
||||
millis -= img.delay;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue