Skip to content

Commit 644ee78

Browse files
committed
revert: ensure N detections to avoid null pointer errors
1 parent 427fcba commit 644ee78

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/ai/onnxruntime/tensor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ macro_rules! v8_slice_from {
3333
(tensor::<$type:ident>($tensor:expr)) => {{
3434
// We must ensure there's some detection to avoid `null pointer` errors
3535
// https://github.com/pykeio/ort/issues/185
36-
if $tensor.shape().is_empty() {
36+
let n_detections = $tensor.shape()[0];
37+
if n_detections == 0 {
3738
let buf_store =
3839
v8::ArrayBuffer::new_backing_store_from_vec(vec![]).make_shared();
3940
let buffer_slice = unsafe {

0 commit comments

Comments
 (0)