Fix possible NPE

- Relates to #182
This commit is contained in:
Janne Valkealahti
2016-03-19 09:09:19 +00:00
parent 981a5335a8
commit 79a91220f6

View File

@@ -120,9 +120,12 @@ public abstract class AbstractStateMachinePersister<S, E, T> implements StateMac
for (State<S, E> ss : states) {
if (ss.isSubmachineState()) {
StateMachine<S, E> submachine = ((AbstractState<S, E>) ss).getSubmachine();
PseudoState<S, E> hh = ((AbstractStateMachine<S, E>) submachine).getHistoryState();
if (hh != null) {
historyStates.put(ss.getId(), ((HistoryPseudoState<S, E>)hh).getState().getId());
PseudoState<S, E> ps = ((AbstractStateMachine<S, E>) submachine).getHistoryState();
if (ps != null) {
State<S, E> pss = ((HistoryPseudoState<S, E>)ps).getState();
if (pss != null) {
historyStates.put(ss.getId(), pss.getId());
}
}
}
}