empty match interception with null return

This commit is contained in:
lion 2025-10-17 12:35:10 +08:00
parent 5a51b75411
commit e3b87326d2
1 changed files with 6 additions and 0 deletions

View File

@ -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}`); // console.log(`dLen: ${dLen}, dPtr: ${dPtr}`);
const region = Buffer.alloc(dLen); const region = Buffer.alloc(dLen);
this.read(dPtr, region); this.read(dPtr, region);