diff --git a/src/viewer/hooks/useStructureRegularExpressionManager.ts b/src/viewer/hooks/useStructureRegularExpressionManager.ts index 4d3eb56..9bba0e2 100644 --- a/src/viewer/hooks/useStructureRegularExpressionManager.ts +++ b/src/viewer/hooks/useStructureRegularExpressionManager.ts @@ -233,8 +233,10 @@ export const useStructureRegularExpressionSearch = ( const indexOfFirstObjectInMatch = logEntryCharIndexMaps.firstCharIndexMap.get(matchRanges[0]); const indexOfLastObjectInMatch = logEntryCharIndexMaps.lastCharIndexMap.get(matchRanges[1]); - for (let i = indexOfFirstObjectInMatch; i <= indexOfLastObjectInMatch; i++) { - indexesOfEntriesInMatch.push(i); + if(indexOfFirstObjectInMatch && indexOfLastObjectInMatch) { + for (let i = indexOfFirstObjectInMatch; i <= indexOfLastObjectInMatch; i++) { + indexesOfEntriesInMatch.push(i); + } } resultingMatches.push(indexesOfEntriesInMatch); diff --git a/src/viewer/types.d.ts b/src/viewer/types.d.ts index 659c9d3..245709f 100644 --- a/src/viewer/types.d.ts +++ b/src/viewer/types.d.ts @@ -59,6 +59,6 @@ export interface Segment { } export interface LogEntryCharMaps { - firstCharIndexMap; - lastCharIndexMap; + firstCharIndexMap: Map; + lastCharIndexMap: Map; }