Issue #2078 - Follow-up: Ensure empty selector lists aren't iterated when serialized

Really odd that this wasn't caught/doesn't cause any issues on MSVC/unoptimized GCC. Must've been luck, I guess.
This commit is contained in:
FranklinDM 2023-03-11 12:08:20 +08:00 committed by roytam1
commit 2be0261d54

View file

@ -1048,6 +1048,10 @@ nsCSSSelectorList::ToString(nsAString& aResult, CSSStyleSheet* aSheet)
{
aResult.Truncate();
nsCSSSelectorList *p = this;
// Don't append anything if we're an empty selector list.
if (!mSelectors) {
return;
}
for (;;) {
p->mSelectors->ToString(aResult, aSheet, true);
p = p->mNext;