- int event = cgMap.get(icsCG);
- LinkedList<Integer[]> choiceLists = backtrackMap.get(event);
- if (choiceLists != null && choiceLists.peekFirst() != null) {
- Integer[] choiceList = choiceLists.removeFirst();
- // Deploy the new choice list for this CG
- icsCG.setNewValues(choiceList);
- icsCG.reset();
- } else {
- // Set done if this was the last backtrack list
- icsCG.setDone();
+ if (cgMap.containsKey(icsCG)) {
+ int event = cgMap.get(icsCG);
+ LinkedList<Integer[]> choiceLists = backtrackMap.get(event);
+ if (choiceLists != null && choiceLists.peekFirst() != null) {
+ Integer[] choiceList = choiceLists.removeFirst();
+ // Deploy the new choice list for this CG
+ icsCG.setNewValues(choiceList);
+ icsCG.reset();
+ } else {
+ // Set done if this was the last backtrack list
+ icsCG.setDone();
+ }