From 97710f429fb06914b5cb86fdd3aa333eb8a90dff Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sat, 10 Sep 2016 14:23:39 +0200 Subject: moc: Fix asserts on moc on empty token preceding ## operator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression introduced in c32ef0a725c7ac9d8a9ab053407389ef2fddc64e The expansion vector can be empty, in that case it is not allowed to call constLast() Task-number: QTBUG-55853 Change-Id: I47aa8eb7507ee91662215df42b4a66eebaa32bb5 Reviewed-by: Jędrzej Nowacki --- src/tools/moc/preprocessor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/tools') diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index 5ce28d931b..11bf8d7937 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -696,9 +696,9 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym next = arg.at(0); } - Symbol last = expansion.constLast(); - if (!expansion.isEmpty() && last.token == s.token && last.token != STRING_LITERAL) { - expansion.pop_back(); + if (!expansion.isEmpty() && expansion.constLast().token == s.token + && expansion.constLast().token != STRING_LITERAL) { + Symbol last = expansion.takeLast(); QByteArray lexem = last.lexem() + next.lexem(); expansion += Symbol(lineNum, last.token, lexem); -- cgit v1.2.3