Merge pull request #118 from pop-os/checked_sub
Use checked_sub to fix panic on window resize.
This commit is contained in:
commit
f2445987fb
1 changed files with 10 additions and 8 deletions
|
|
@ -243,14 +243,16 @@ impl<'b> Iterator for LayoutRunIter<'b> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.remaining_len -= 1;
|
return self.remaining_len.checked_sub(1).map(|num| {
|
||||||
return Some(LayoutRun {
|
self.remaining_len = num;
|
||||||
line_i: self.line_i,
|
LayoutRun {
|
||||||
text: line.text(),
|
line_i: self.line_i,
|
||||||
rtl: shape.rtl,
|
text: line.text(),
|
||||||
glyphs: &layout_line.glyphs,
|
rtl: shape.rtl,
|
||||||
line_y: self.line_y,
|
glyphs: &layout_line.glyphs,
|
||||||
line_w: layout_line.w,
|
line_y: self.line_y,
|
||||||
|
line_w: layout_line.w,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
self.line_i += 1;
|
self.line_i += 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue