mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 23:25:20 +00:00
LibWeb: Be more forgiving when adding source positions in HTMLTokenizer
This patch changes HTMLTokenizer::nth_last_position to not fail if the requested position is not available. Rather, it will just return (0-0). While this is not the correct solution, it prevents the tokenizer from crashing just because it cannot find a source position. This should only affect SyntaxHighlighter.
This commit is contained in:
committed by
Ali Mohammad Pur
parent
93d830b5cc
commit
932161e581
@@ -147,7 +147,7 @@ private:
|
||||
bool consumed_as_part_of_an_attribute() const;
|
||||
|
||||
void restore_to(const Utf8CodePointIterator& new_iterator);
|
||||
auto& nth_last_position(size_t n = 0) { return m_source_positions.at(m_source_positions.size() - 1 - n); }
|
||||
HTMLToken::Position nth_last_position(size_t n = 0);
|
||||
|
||||
State m_state { State::Data };
|
||||
State m_return_state { State::Data };
|
||||
|
||||
Reference in New Issue
Block a user