LibWeb: Consider last resort font in font list
Getting the first font in a font cascade list with an empty font list results in an OOTB index error. If the font list is empty, the last resort font should be returned instead.
This commit is contained in:
parent
b3f77e4769
commit
f3a6a589c8
Notes:
github-actions[bot]
2024-09-08 11:44:09 +00:00
Author: https://github.com/Kuba314 🔰 Commit: https://github.com/LadybirdBrowser/ladybird/commit/f3a6a589c89 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1325 Reviewed-by: https://github.com/kalenikaliaksandr ✅
1 changed files with 1 additions and 1 deletions
|
@ -20,7 +20,7 @@ public:
|
|||
|
||||
size_t size() const { return m_fonts.size(); }
|
||||
bool is_empty() const { return m_fonts.is_empty() && !m_last_resort_font; }
|
||||
Font const& first() const { return *m_fonts.first().font; }
|
||||
Font const& first() const { return !m_fonts.is_empty() ? *m_fonts.first().font : *m_last_resort_font; }
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_font_entry(Callback callback) const
|
||||
|
|
Loading…
Add table
Reference in a new issue