From f0428d79ca2936548526a97514360d0c0a495a73 Mon Sep 17 00:00:00 2001 From: Leon Scherer <55341374+Fruup@users.noreply.github.com> Date: Sun, 2 Feb 2025 02:11:01 +0100 Subject: [PATCH] fix: sending invalid index to opencv --- src/jscanify.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/jscanify.js b/src/jscanify.js index 53a3c19..bd3a16c 100644 --- a/src/jscanify.js +++ b/src/jscanify.js @@ -71,7 +71,10 @@ } } - const maxContour = contours.get(maxContourIndex); + const maxContour = + maxContourIndex >= 0 ? + contours.get(maxContourIndex) : + null; imgGray.delete(); imgBlur.delete();