Fix: Fixed null value handling and ensure exceptions are avoided

This commit is contained in:
IcySugar000
2025-04-09 11:30:29 +08:00
parent 27d31ca29c
commit 8aa3cd799a
2 changed files with 4 additions and 0 deletions

View File

@@ -334,6 +334,7 @@ def split_string_by_multi_markers(content: str, markers: list[str]) -> list[str]
"""Split a string by multiple markers"""
if not markers:
return [content]
content = content if content is not None else ""
results = re.split("|".join(re.escape(marker) for marker in markers), content)
return [r.strip() for r in results if r.strip()]