mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 22:30:03 -04:00
Fix panic if no fonts loaded
This commit is contained in:
@@ -390,7 +390,12 @@ impl Font<'_> {
|
|||||||
/// Returns a value rounded to [`emath::GUI_ROUNDING`].
|
/// Returns a value rounded to [`emath::GUI_ROUNDING`].
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn row_height(&self, font_size: f32) -> f32 {
|
pub fn row_height(&self, font_size: f32) -> f32 {
|
||||||
let Some(first_font) = self.fonts_by_id.get(&self.cached_family.fonts[0]) else {
|
let Some(first_font) = self
|
||||||
|
.cached_family
|
||||||
|
.fonts
|
||||||
|
.first()
|
||||||
|
.and_then(|key| self.fonts_by_id.get(key))
|
||||||
|
else {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
};
|
};
|
||||||
first_font.row_height(font_size)
|
first_font.row_height(font_size)
|
||||||
|
|||||||
Reference in New Issue
Block a user