mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibGfx: Ignore incorrect .font files when building the Font Database
Previously every GUI application would crash if we had an incorrect (or empty) .font file in /res/fonts.
This commit is contained in:
parent
6af184b48b
commit
652870c178
Notes:
sideshowbarker
2024-07-17 07:33:14 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/652870c178 Pull-request: https://github.com/SerenityOS/serenity/pull/15098
1 changed files with 2 additions and 1 deletions
|
@ -132,7 +132,8 @@ FontDatabase::FontDatabase()
|
|||
auto path = dir_iterator.next_full_path();
|
||||
|
||||
if (path.ends_with(".font"sv)) {
|
||||
if (auto font = Gfx::BitmapFont::load_from_file(path)) {
|
||||
if (auto font_or_error = Gfx::BitmapFont::try_load_from_file(path); !font_or_error.is_error()) {
|
||||
auto font = font_or_error.release_value();
|
||||
m_private->full_name_to_font_map.set(font->qualified_name(), *font);
|
||||
auto typeface = get_or_create_typeface(font->family(), font->variant());
|
||||
typeface->add_bitmap_font(font);
|
||||
|
|
Loading…
Reference in a new issue