From a3028c14d8f32e44c44cd086409d42885a8eef48 Mon Sep 17 00:00:00 2001 From: Olivier Louvignes Date: Fri, 13 Oct 2023 21:10:42 +0200 Subject: [PATCH] chore(processor): add guard against non-array values from frame-processor --- src/module.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/module.ts b/src/module.ts index 642255e..6b6f720 100644 --- a/src/module.ts +++ b/src/module.ts @@ -66,6 +66,10 @@ export const scanCodes = ( frame, options, ) as unknown as (AndroidBarcode | iOSBarcode)[]; + if (!Array.isArray(nativeCodes)) { + console.warn("Native frame processor failed to return a proper array!"); + return []; + } return nativeCodes.map((nativeBarcode) => normalizeNativeBarcode(nativeBarcode, frame), );