diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-04-06 13:44:13 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-04-18 08:07:17 +0000 |
commit | 382aac3e7877c151eaef5f7bb3fedefc10a8f284 (patch) | |
tree | 3123ddc4f55b37ad9c6b924345f667520eceb421 /src | |
parent | 8dee4c71a563c39fb622e054f5cdacdd797f41fb (diff) |
Don't crash when trying to execute things in the null data model
Rather raise error.execution, as mandated by the standard (in most of
those cases).
Change-Id: If2e200693198b70b4bf067011318f0d78c44653b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/scxml/qscxmlnulldatamodel.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/scxml/qscxmlnulldatamodel.cpp b/src/scxml/qscxmlnulldatamodel.cpp index c888708..a2d8a14 100644 --- a/src/scxml/qscxmlnulldatamodel.cpp +++ b/src/scxml/qscxmlnulldatamodel.cpp @@ -164,38 +164,48 @@ bool QScxmlNullDataModel::evaluateToBool(QScxmlExecutableContent::EvaluatorId id QVariant QScxmlNullDataModel::evaluateToVariant(QScxmlExecutableContent::EvaluatorId id, bool *ok) { Q_UNUSED(id); - Q_UNUSED(ok); - Q_UNREACHABLE(); + *ok = false; + QScxmlStateMachinePrivate::get(stateMachine())->submitError( + QStringLiteral("error.execution"), + QStringLiteral("Cannot evaluate expressions on a null data model")); return QVariant(); } void QScxmlNullDataModel::evaluateToVoid(QScxmlExecutableContent::EvaluatorId id, bool *ok) { Q_UNUSED(id); - Q_UNUSED(ok); - Q_UNREACHABLE(); + *ok = false; + QScxmlStateMachinePrivate::get(stateMachine())->submitError( + QStringLiteral("error.execution"), + QStringLiteral("Cannot evaluate expressions on a null data model")); } void QScxmlNullDataModel::evaluateAssignment(QScxmlExecutableContent::EvaluatorId id, bool *ok) { Q_UNUSED(id); - Q_UNUSED(ok); - Q_UNREACHABLE(); + *ok = false; + QScxmlStateMachinePrivate::get(stateMachine())->submitError( + QStringLiteral("error.execution"), + QStringLiteral("Cannot assign values on a null data model")); } void QScxmlNullDataModel::evaluateInitialization(QScxmlExecutableContent::EvaluatorId id, bool *ok) { Q_UNUSED(id); - Q_UNUSED(ok); - Q_UNREACHABLE(); + *ok = false; + QScxmlStateMachinePrivate::get(stateMachine())->submitError( + QStringLiteral("error.execution"), + QStringLiteral("Cannot initialize values on a null data model")); } bool QScxmlNullDataModel::evaluateForeach(QScxmlExecutableContent::EvaluatorId id, bool *ok, ForeachLoopBody *body) { Q_UNUSED(id); - Q_UNUSED(ok); Q_UNUSED(body); - Q_UNREACHABLE(); + *ok = false; + QScxmlStateMachinePrivate::get(stateMachine())->submitError( + QStringLiteral("error.execution"), + QStringLiteral("Cannot run foreach on a null data model")); return false; } |