From 500067d3a62ac87f78adaaa0bd6f290a915c5fe5 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 4 Sep 2021 17:37:02 +0200 Subject: [PATCH] LibGfx: Make FontDatabase cache store fonts in NonnullRefPtr We don't cache failed font lookups, so there's no need for nullity here. --- Userland/Libraries/LibGfx/FontDatabase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/FontDatabase.cpp b/Userland/Libraries/LibGfx/FontDatabase.cpp index 68b16547f0..d866133238 100644 --- a/Userland/Libraries/LibGfx/FontDatabase.cpp +++ b/Userland/Libraries/LibGfx/FontDatabase.cpp @@ -76,7 +76,7 @@ Font& FontDatabase::default_fixed_width_font() } struct FontDatabase::Private { - HashMap> full_name_to_font_map; + HashMap> full_name_to_font_map; Vector> typefaces; }; @@ -93,7 +93,7 @@ FontDatabase::FontDatabase() if (path.ends_with(".font"sv)) { if (auto font = Gfx::BitmapFont::load_from_file(path)) { - m_private->full_name_to_font_map.set(font->qualified_name(), font); + 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); }