@@ -53,6 +53,7 @@ class DeleteChoicesOperation extends Task {
5353 private HashSet <ChoiceCell > cellsToDelete ;
5454 private final BaseChoiceSetManager .ChoicesOperationCompletionListener completionListener ;
5555 private HashSet <ChoiceCell > loadedCells ;
56+ private List <DeleteInteractionChoiceSet > deleteChoices ;
5657 private boolean completionSuccess = false ;
5758
5859 DeleteChoicesOperation (ISdl internalInterface , HashSet <ChoiceCell > cellsToDelete , HashSet <ChoiceCell > loadedCells , BaseChoiceSetManager .ChoicesOperationCompletionListener completionListener ) {
@@ -79,7 +80,7 @@ public void onExecute() {
7980
8081 private void sendDeletions () {
8182
82- List < DeleteInteractionChoiceSet > deleteChoices = createDeleteSets ();
83+ deleteChoices = createDeleteSets ();
8384
8485 if (deleteChoices .size () > 0 ) {
8586
@@ -110,7 +111,7 @@ public void onResponse(int correlationId, RPCResponse response) {
110111 DeleteChoicesOperation .super .onFinished ();
111112 } else {
112113 if (loadedCells != null ) {
113- loadedCells .remove (loadedCellFromChoiceId ( correlationId ));
114+ loadedCells .remove (loadedCellFromCorrelationId ( deleteChoices , correlationId ));
114115 }
115116 }
116117 }
@@ -144,7 +145,20 @@ private void updateCellsToDelete() {
144145 this .cellsToDelete = updatedCellsToDelete ;
145146 }
146147
147- private ChoiceCell loadedCellFromChoiceId (int choiceId ) {
148+ private ChoiceCell loadedCellFromCorrelationId (List <DeleteInteractionChoiceSet > deleteRpcs , int correlationId ) {
149+
150+ Integer choiceId = null ;
151+
152+ for (DeleteInteractionChoiceSet rpc : deleteRpcs ) {
153+ if (rpc .getCorrelationID () == correlationId ) {
154+ choiceId = rpc .getInteractionChoiceSetID ();
155+ }
156+ }
157+
158+ if (choiceId == null ) {
159+ return null ;
160+ }
161+
148162 for (ChoiceCell cell : this .loadedCells ) {
149163 if (cell .getChoiceId () == choiceId ) {
150164 return cell ;
0 commit comments