diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 0b8fa3db5b..3d0b1e92fd 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1468,17 +1468,14 @@ void QStateMachinePrivate::goToState(QAbstractState *targetState) if (configuration.contains(targetState)) return; + Q_ASSERT(state == Running); QState *sourceState = 0; - if (state == Running) { - QSet::const_iterator it; - for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { - sourceState = toStandardState(*it); - if (sourceState != 0) - break; - } - } else { - sourceState = startState(); - } + QSet::const_iterator it; + for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { + sourceState = toStandardState(*it); + if (sourceState != 0) + break; + } Q_ASSERT(sourceState != 0); // Reuse previous GoToStateTransition in case of several calls to