From e3b87326d207f7e18dca1af79c78202fa55f71d4 Mon Sep 17 00:00:00 2001 From: lion Date: Fri, 17 Oct 2025 12:35:10 +0800 Subject: [PATCH] empty match interception with null return --- binding/javascript/searcher.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/binding/javascript/searcher.js b/binding/javascript/searcher.js index 67be219..b2e29a7 100644 --- a/binding/javascript/searcher.js +++ b/binding/javascript/searcher.js @@ -88,6 +88,12 @@ export class Searcher { } } + // empty match interception. + // and this could be a case. + if (dPtr == -1) { + return null; + } + // console.log(`dLen: ${dLen}, dPtr: ${dPtr}`); const region = Buffer.alloc(dLen); this.read(dPtr, region);