Skip to content

Commit d2d642a

Browse files
committed
fix: safeguard against regex error due to input string breaking regex compilation; Fixes #40
1 parent f8d4d68 commit d2d642a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/file_interaction.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ def search_keywords(keywords: str):
8888
name = os.path.basename(path)
8989
line_nr = line_parts[1]
9090
code_line = ":".join(line_parts[2:])
91-
match = re.search(keyword, code_line)
91+
try:
92+
match = re.search(keyword, code_line)
93+
except Exception as e:
94+
logger.info(f"Error in regex matching for regex keyword {keyword}: {e}")
95+
match = None
9296
if match is None:
9397
continue
9498
span = match.span()

0 commit comments

Comments
 (0)