Skip to content

Commit

Permalink
Do not panic when there is no damage rectangle
Browse files Browse the repository at this point in the history
  • Loading branch information
CBenoit authored and daxpedda committed Sep 9, 2023
1 parent b7e0f6a commit 9cfff8b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ impl WebImpl {

let mut damage_iter = damage.iter();

let first_rect = damage_iter.next().expect("at least one damage rectangle");
let first_rect = if let Some(rect) = damage_iter.next() {
rect
} else {
// If there is no damage, there is nothing to do
return Ok(());
};

struct UnionRegion {
top: u32,
Expand Down

0 comments on commit 9cfff8b

Please sign in to comment.