diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-05-07 15:18:51 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-05-07 15:18:51 (GMT) |
commit | 00f04527d3d28ab1aa5b90b9a05366012ff5d1e5 (patch) | |
tree | d44b989946d9248755a3e708caeca44ee1368c25 /src/corelib/statemachine | |
parent | b39781b214e2502e0884bce88aa3ac324f2d0b12 (diff) | |
download | Qt-00f04527d3d28ab1aa5b90b9a05366012ff5d1e5.zip Qt-00f04527d3d28ab1aa5b90b9a05366012ff5d1e5.tar.gz Qt-00f04527d3d28ab1aa5b90b9a05366012ff5d1e5.tar.bz2 |
don't add signal transition if target is null or signal doesn't exist
Diffstat (limited to 'src/corelib/statemachine')
-rw-r--r-- | src/corelib/statemachine/qstate.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index acee27d..4d12219 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -346,6 +346,15 @@ QSignalTransition *QState::addTransition(QObject *sender, const char *signal, qWarning("QState::addTransition: signal cannot be null"); return 0; } + if (!target) { + qWarning("QState::addTransition: cannot add transition to null state"); + return 0; + } + if (*signal && sender->metaObject()->indexOfSignal(signal+1) == -1) { + qWarning("QState::addTransition: no such signal %s::%s", + sender->metaObject()->className(), signal+1); + return 0; + } QSignalTransition *trans = new QSignalTransition(sender, signal, QList<QAbstractState*>() << target); addTransition(trans); return trans; |