Skip to content

Commit f3ef42b

Browse files
committed
chore: enhance re_findall function to handle None and empty string patterns
1 parent 0b72c5d commit f3ef42b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

apps/common/utils/split_model.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,12 @@ def parse_level(text, pattern: str):
169169

170170

171171
def re_findall(pattern, text):
172-
if not pattern or not pattern.strip():
172+
# 检查 pattern 是否为空或无效
173+
if pattern is None:
174+
return []
175+
176+
# 如果是字符串类型,检查是否为空字符串
177+
if isinstance(pattern, str) and (not pattern or not pattern.strip()):
173178
return []
174179

175180
try:

0 commit comments

Comments
 (0)