Early panic on divide by zero
This commit is contained in:
parent
cb4d544688
commit
c4ee3ba64e
1 changed files with 2 additions and 0 deletions
|
|
@ -306,6 +306,8 @@ pub struct Buffer<'a> {
|
||||||
impl<'a> Buffer<'a> {
|
impl<'a> Buffer<'a> {
|
||||||
/// Create a new [`Buffer`] with the provided [`FontSystem`] and [`Metrics`]
|
/// Create a new [`Buffer`] with the provided [`FontSystem`] and [`Metrics`]
|
||||||
pub fn new(font_system: &'a FontSystem, metrics: Metrics) -> Self {
|
pub fn new(font_system: &'a FontSystem, metrics: Metrics) -> Self {
|
||||||
|
assert_ne!(metrics.line_height, 0, "line height cannot be 0");
|
||||||
|
|
||||||
let mut buffer = Self {
|
let mut buffer = Self {
|
||||||
font_system,
|
font_system,
|
||||||
lines: Vec::new(),
|
lines: Vec::new(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue