File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,11 @@ def extract_command(text: Optional[str]) -> Optional[str]:
1919 if not trimmed .startswith ('/' ):
2020 return None
2121
22- command = trimmed .split ()[0 ]
22+ parts = trimmed .split ()
23+ if not parts :
24+ return None
25+
26+ command = parts [0 ]
2327 if '@' in command :
2428 command = command .split ('@' , 1 )[0 ]
2529 return command or None
@@ -36,7 +40,7 @@ def load_command_whitelist(config_path: Path = DEFAULT_CONFIG_PATH) -> list[str]
3640 whitelist = data .get ('white_list_commands' , {}).get ('whitelist' , [])
3741 if isinstance (whitelist , list ):
3842 return [cmd for cmd in whitelist if isinstance (cmd , str )]
39- except Exception as exc : # pragma: no cover - defensive logging
43+ except ( OSError , tomllib . TOMLDecodeError ) as exc : # pragma: no cover - defensive logging
4044 logger .warning (f"Failed to load command whitelist: { exc } " )
4145 return []
4246
You can’t perform that action at this time.
0 commit comments