diff options
Diffstat (limited to 'Userland/Libraries/LibGfx/FontDatabase.cpp')
-rw-r--r-- | Userland/Libraries/LibGfx/FontDatabase.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGfx/FontDatabase.cpp b/Userland/Libraries/LibGfx/FontDatabase.cpp index 76d4517b80..85c8adf7e2 100644 --- a/Userland/Libraries/LibGfx/FontDatabase.cpp +++ b/Userland/Libraries/LibGfx/FontDatabase.cpp @@ -99,9 +99,10 @@ FontDatabase::FontDatabase() } } else if (path.ends_with(".ttf"sv)) { // FIXME: What about .otf and .woff - if (auto font = TTF::Font::load_from_file(path)) { + if (auto font_or_error = TTF::Font::try_load_from_file(path); !font_or_error.is_error()) { + auto font = font_or_error.release_value(); auto typeface = get_or_create_typeface(font->family(), font->variant()); - typeface->set_ttf_font(font); + typeface->set_ttf_font(move(font)); } } } |