diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-04-05 14:05:16 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-04-14 15:14:44 +0000 |
commit | 972eaad3123f0471345e514b6b7b095fe5728f6e (patch) | |
tree | 37aefa7c5f068c6469ccd04d3feb8dbc1724454f /src | |
parent | 14c1090c89bba1af881d568274d4f1b9fe5f8a28 (diff) |
Don't crash on misplaced <invoke>
Change-Id: I052261ef64ae4ada5c93211c61718cd81e4f0dd7
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/scxml/qscxmlparser.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/scxml/qscxmlparser.cpp b/src/scxml/qscxmlparser.cpp index 83cdd7b..5857b5a 100644 --- a/src/scxml/qscxmlparser.cpp +++ b/src/scxml/qscxmlparser.cpp @@ -2471,8 +2471,16 @@ void QScxmlParserPrivate::parse() m_stack.append(pNew); } else if (elName == QLatin1String("finalize")) { ParserState pNew(ParserState::Finalize); - auto invoke = m_stack.last().instruction->asInvoke(); - Q_ASSERT(invoke); + auto instr = m_stack.last().instruction; + if (!instr) { + addError(QStringLiteral("no previous instruction found for <finalize>")); + return; + } + auto invoke = instr->asInvoke(); + if (!invoke) { + addError(QStringLiteral("instruction before <finalize> is not <invoke>")); + return; + } pNew.instructionContainer = &invoke->finalize; m_stack.append(pNew); } else { |