Skip to content

Commit f19ec8b

Browse files
committed
fix a bug with empty multidim arrays
1 parent 7576c67 commit f19ec8b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/algorithm/pervade.rs

+9
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ fn bin_pervade_recursive_mut<T>(
310310
}
311311
}
312312
(ash, bsh) => {
313+
if ash[0] == 0 || bsh[0] == 0 {
314+
return;
315+
}
313316
let a_row_len = a_data.len() / ash[0];
314317
let b_row_len = b_data.len() / bsh[0];
315318
for (a, b) in a_data
@@ -342,6 +345,9 @@ fn bin_pervade_recursive_mut_left<T>(
342345
}
343346
}
344347
(ash, bsh) => {
348+
if ash[0] == 0 || bsh[0] == 0 {
349+
return;
350+
}
345351
let a_row_len = a_data.len() / ash[0];
346352
let b_row_len = b_data.len() / bsh[0];
347353
for (a, b) in a_data
@@ -374,6 +380,9 @@ fn bin_pervade_recursive_mut_right<T>(
374380
}
375381
}
376382
(ash, bsh) => {
383+
if ash[0] == 0 || bsh[0] == 0 {
384+
return;
385+
}
377386
let a_row_len = a_data.len() / ash[0];
378387
let b_row_len = b_data.len() / bsh[0];
379388
for (a, b) in a_data

0 commit comments

Comments
 (0)