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();