Skip to content

Commit 495639f

Browse files
committed
chore: 🧹
1 parent 9bcffa8 commit 495639f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • packages/react-native-executorch/common/rnexecutorch/host_objects

packages/react-native-executorch/common/rnexecutorch/host_objects/JsiConversions.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,11 @@ inline JsiTensorView getValue<JsiTensorView>(const jsi::Value &val,
7676
tensorView.numel = arrayBytes / elementBytes;
7777
} else {
7878
// Handle typed arrays (Float32Array, Int32Array, etc.)
79-
if (dataObj.hasProperty(runtime, "buffer") ||
80-
dataObj.hasProperty(runtime, "byteOffset") ||
81-
dataObj.hasProperty(runtime, "byteLength") ||
82-
dataObj.hasProperty(runtime, "length")) {
79+
const bool isValidTypedArray = dataObj.hasProperty(runtime, "buffer") &&
80+
dataObj.hasProperty(runtime, "byteOffset") &&
81+
dataObj.hasProperty(runtime, "byteLength") &&
82+
dataObj.hasProperty(runtime, "length");
83+
if (!isValidTypedArray) {
8384
throw jsi::JSError(runtime, "Data must be an ArrayBuffer or TypedArray");
8485
}
8586
tensorView.numel =

0 commit comments

Comments
 (0)