1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +00:00

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.
This commit is contained in:
Sam Atkins 2021-09-12 15:02:04 +01:00 committed by Andreas Kling
parent f58f58fb77
commit 8ddce2faaf

View file

@ -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>