Commit 4d26f334 authored by Leandro Melo's avatar Leandro Melo

Small change to the behaviour of the highlighter that should help it working with broken files.

parent 44202754
......@@ -422,8 +422,12 @@ void Highlighter::pushDynamicContext(const QSharedPointer<Context> &baseContext)
void Highlighter::setCurrentContext()
{
if (m_contexts.isEmpty())
throw HighlighterException();
if (m_contexts.isEmpty()) {
// This is not supposed to happen. However, there might be broken files (for example, the
// PHP definition) which will cause this behaviour. In such cases just pushing the default
// context is enough to keep highlighter working.
m_contexts.push_back(m_defaultContext);
}
m_currentContext = m_contexts.back();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment