Skip to content

Commit 2cbbb7e

Browse files
committed
REXsort crash fixed
1 parent 984d3a2 commit 2cbbb7e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/algorithms/controllers/MSDRadixSort.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,19 +226,19 @@ export default {
226226
// init, before partition
227227
highlight(vis, cur_i)
228228
highlight(vis, cur_j)
229-
} else if (cur_i !== undefined && tmp_j === undefined && prev_i !== undefined) {
229+
} else if (isRecursionExpanded() && cur_i !== undefined && tmp_j === undefined && prev_i !== undefined) {
230230
// just before first recursive call
231231
unhighlight(vis, prev_i)
232232
if (prev_j >= 0) // might have fallen off array
233233
unhighlight(vis, prev_j)
234234
} else if (checkingLeft) {
235-
if (prev_i !== undefined && prev_i !== cur_j)
235+
if (isRecursionExpanded() && prev_i !== undefined && prev_i !== cur_j)
236236
unhighlight(vis, prev_i)
237237
highlight(vis, cur_i)
238238
if (arr && cur_i !== undefined)
239239
updateBinary(vis, arr[cur_i])
240240
} else {
241-
if (prev_j !== undefined && prev_j !== cur_i)
241+
if (isRecursionExpanded() && prev_j !== undefined && prev_j !== cur_i)
242242
unhighlight(vis, prev_j);
243243
if (cur_j !== undefined) { // might have fallen off array
244244
highlight(vis, cur_j);

0 commit comments

Comments
 (0)