Skip to content

Commit 9dde08e

Browse files
committed
FIX: Deny 0-dim arrays in try_append_to_array
1 parent b8aea7a commit 9dde08e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/impl_owned_array.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,10 @@ impl<A, D> Array<A, D>
258258
A: Clone,
259259
D: RemoveAxis,
260260
{
261-
assert_ne!(self.ndim(), 0, "Impossible to append to 0-dim array");
261+
if self.ndim() == 0 {
262+
return Err(ShapeError::from_kind(ErrorKind::IncompatibleShape));
263+
}
264+
262265
let current_axis_len = self.len_of(axis);
263266
let remaining_shape = self.raw_dim().remove_axis(axis);
264267
let array_rem_shape = array.raw_dim().remove_axis(axis);

0 commit comments

Comments
 (0)