From 4d26f334e24859c2350fd7aad6524a7f1222c921 Mon Sep 17 00:00:00 2001 From: Leandro Melo <leandro.melo@nokia.com> Date: Thu, 6 May 2010 10:10:04 +0200 Subject: [PATCH] Small change to the behaviour of the highlighter that should help it working with broken files. --- src/plugins/genericeditor/highlighter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/genericeditor/highlighter.cpp b/src/plugins/genericeditor/highlighter.cpp index 67b90fe0f6d..416ee872141 100644 --- a/src/plugins/genericeditor/highlighter.cpp +++ b/src/plugins/genericeditor/highlighter.cpp @@ -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(); } -- GitLab