moc: Fix assertion in QVector::first()

introduced in aea68c93ae

Change-Id: I05c1dfa16c42019ee0a0b44ffc50ad2c2c0d209b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Konstantin Ritt 2012-11-25 05:54:45 +02:00 committed by The Qt Project
parent 3aa55d5a25
commit 6d1acac613

View File

@ -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.last().token == PP_WHITESPACE || macro.symbols.last().token == WHITESPACE))
macro.symbols.pop_back(); macro.symbols.pop_back();
if (macro.symbols.first().token == PP_HASHHASH || if (!macro.symbols.isEmpty()) {
macro.symbols.last().token == PP_HASHHASH) if (macro.symbols.first().token == PP_HASHHASH ||
error("'##' cannot appear at either end of a macro expansion"); macro.symbols.last().token == PP_HASHHASH) {
if (macro.symbols.last().token == HASH || error("'##' cannot appear at either end of a macro expansion");
macro.symbols.last().token == PP_HASH) }
error("'#' is not followed by a macro parameter"); if (macro.symbols.last().token == HASH ||
macro.symbols.last().token == PP_HASH) {
error("'#' is not followed by a macro parameter");
}
}
macros.insert(name, macro); macros.insert(name, macro);
continue; continue;
} }