avoid a crash with empty text (happening in building info panels, for example) [rebuild]

This commit is contained in:
Dustin Carlino 2020-02-10 10:10:05 -08:00
parent 6ff0c85a14
commit 9c5ea334e0

View File

@ -409,8 +409,10 @@ impl GeomBatch {
}
pub fn get_dims(&self) -> ScreenDims {
// TODO Maybe warn about this happening and avoid in the first place? Sometimes we wind up
// trying to draw completely empty text.
if self.is_empty() {
panic!("Can't get_dims of empty GeomBatch");
return ScreenDims::new(0.0, 0.0);
}
let mut bounds = Bounds::new();
for (_, poly) in &self.list {