summaryrefslogtreecommitdiffstats
path: root/src/tools/moc
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-11-25 05:54:45 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-25 20:58:17 +0100
commit6d1acac613d59ecd1c48e3577ed42facb38a5e5a (patch)
tree1cc45d4faedd74b450710d2ba84daf6ae107407e /src/tools/moc
parent3aa55d5a252673474c14ce7b8c12711f6624c550 (diff)
moc: Fix assertion in QVector::first()
introduced in aea68c93ae437a761584719f0f1ca93eaf6f7484 Change-Id: I05c1dfa16c42019ee0a0b44ffc50ad2c2c0d209b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/tools/moc')
-rw-r--r--src/tools/moc/preprocessor.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 72fecf0a46..f30683c629 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -1099,12 +1099,16 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
(macro.symbols.last().token == PP_WHITESPACE || macro.symbols.last().token == WHITESPACE))
macro.symbols.pop_back();
- if (macro.symbols.first().token == PP_HASHHASH ||
- macro.symbols.last().token == PP_HASHHASH)
- error("'##' cannot appear at either end of a macro expansion");
- if (macro.symbols.last().token == HASH ||
- macro.symbols.last().token == PP_HASH)
- error("'#' is not followed by a macro parameter");
+ if (!macro.symbols.isEmpty()) {
+ if (macro.symbols.first().token == PP_HASHHASH ||
+ macro.symbols.last().token == PP_HASHHASH) {
+ error("'##' cannot appear at either end of a macro expansion");
+ }
+ if (macro.symbols.last().token == HASH ||
+ macro.symbols.last().token == PP_HASH) {
+ error("'#' is not followed by a macro parameter");
+ }
+ }
macros.insert(name, macro);
continue;
}