Generic Highlighter: Don't crash with bogus #pop directives.

Task-number: QTCREATORBUG-7583

Change-Id: Ie11c0c1d9b900c5d5d92c0e856bae762bb90cb4a
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Eike Ziller
2012-08-02 11:52:28 +02:00
parent 624aada0d9
commit 582a082cd7

View File

@@ -323,8 +323,11 @@ void Highlighter::changeContext(const QString &contextName,
{
if (contextName.startsWith(kPop)) {
QStringList list = contextName.split(kHash, QString::SkipEmptyParts);
for (int i = 0; i < list.size(); ++i)
for (int i = 0; i < list.size(); ++i) {
if (m_contexts.isEmpty())
throw HighlighterException();
m_contexts.pop_back();
}
if (extractObservableState(currentBlockState()) >= PersistentsStart) {
// One or more contexts were popped during during a persistent state.