Skip to content

Commit 51d459a

Browse files
committed
Check state map for null rule.
Log if necessary.
1 parent 7ecf93d commit 51d459a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis/StreamStateMachine.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,15 @@ private Set<InstanceKey> getAllPredecessors(InstanceKey instanceKey) {
919919
}
920920

921921
public Collection<IDFAState> getStates(StreamAttributeTypestateRule rule, InstanceKey instanceKey) {
922-
return this.originStreamToMergedTypeStateMap.get(instanceKey).get(rule);
922+
Map<TypestateRule, Set<IDFAState>> mergedTypeState = this.originStreamToMergedTypeStateMap.get(instanceKey);
923+
924+
if (mergedTypeState == null) {
925+
LOGGER.warning(
926+
() -> "Can't find merged type state for rule: " + rule + " and instance key: " + instanceKey);
927+
return Collections.emptySet();
928+
}
929+
930+
return mergedTypeState.get(rule);
923931
}
924932

925933
public Collection<InstanceKey> getTrackedInstances() {

0 commit comments

Comments
 (0)