summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2021-09-12 15:02:04 +0100
committerAndreas Kling <kling@serenityos.org>2021-09-12 16:11:48 +0200
commit8ddce2faaff8405fc1435749631d1926767f9826 (patch)
treee79827164a83931a4324064a475dac3c62480d42
parentf58f58fb774d96d6fe1b1b9350bef233d4814967 (diff)
downloadserenity-8ddce2faaff8405fc1435749631d1926767f9826.zip
LibWeb: Don't assert if reconsuming on an empty TokenStream
This fixes #9978. When a TokenStream is empty, reading its `current_token()` still returns a token (for EOF) so it makes sense to allow users to `reconsume_current_input_token()` that token, so they do not have to handle that themselves. Instead of VERIFY()ing, we can just no-op when reconsuming token 0.
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index dfa0f4d914..11d59cbb44 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -105,8 +105,8 @@ T const& TokenStream<T>::current_token()
template<typename T>
void TokenStream<T>::reconsume_current_input_token()
{
- VERIFY(m_iterator_offset >= 0);
- --m_iterator_offset;
+ if (m_iterator_offset >= 0)
+ --m_iterator_offset;
}
template<typename T>