Fix crash when drawing Predrawn with width 0

This commit is contained in:
Joscha 2024-01-14 12:32:10 +01:00
parent b01ee297d5
commit 2d604d606c
2 changed files with 6 additions and 0 deletions

View file

@ -13,6 +13,9 @@ Procedure when bumping the version number:
## Unreleased ## Unreleased
### Fixed
- Crash when drawing `widgets::Predrawn` with width 0
## v0.2.1 - 2024-01-05 ## v0.2.1 - 2024-01-05
### Added ### Added

View file

@ -332,6 +332,9 @@ impl<'a> Iterator for Cells<'a> {
type Item = (u16, u16, &'a Cell); type Item = (u16, u16, &'a Cell);
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
if self.x >= self.buffer.size.width {
return None;
}
if self.y >= self.buffer.size.height { if self.y >= self.buffer.size.height {
return None; return None;
} }