Skip to content

Commit

Permalink
LibWeb: Verify something was removed in StyleSheetList::remove_sheet()
Browse files Browse the repository at this point in the history
This would have saved me an hour of debugging, so putting it here for
the next person. :^)
  • Loading branch information
awesomekling committed Jul 23, 2024
1 parent f3ec215 commit cc8a18b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Userland/Libraries/LibWeb/CSS/StyleSheetList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ void StyleSheetList::add_sheet(CSSStyleSheet& sheet)
void StyleSheetList::remove_sheet(CSSStyleSheet& sheet)
{
sheet.set_style_sheet_list({}, nullptr);
m_sheets.remove_first_matching([&](auto& entry) { return entry.ptr() == &sheet; });
bool did_remove = m_sheets.remove_first_matching([&](auto& entry) { return entry.ptr() == &sheet; });
VERIFY(did_remove);

if (sheet.rules().length() == 0) {
// NOTE: If the removed sheet had no rules, we don't have to invalidate anything.
Expand Down

0 comments on commit cc8a18b

Please sign in to comment.