Fix possible NPE in RegionState

This commit is contained in:
Janne Valkealahti
2015-05-15 15:15:26 +01:00
parent d847dbacc4
commit d29c240ad0
2 changed files with 4 additions and 3 deletions

View File

@@ -110,7 +110,9 @@ public class RegionState<S, E> extends AbstractState<S, E> {
@Override
public void exit(StateContext<S, E> context) {
for (Region<S, E> region : getRegions()) {
region.getState().exit(context);
if (region.getState() != null) {
region.getState().exit(context);
}
region.stop();
}
Collection<? extends Action<S, E>> actions = getExitActions();

View File

@@ -80,8 +80,7 @@ public class EndStateTests extends AbstractStateMachineTests {
assertThat(machine.getState().getIds(), contains(TestStates3.READY));
}
// disable for now, fix in other ticket
//@Test
@Test
public void testEndStatesWithRegionsDefinedInStates() throws InterruptedException {
context.register(Config3.class);
context.refresh();