Skip to content
Snippets Groups Projects
Unverified Commit e9015880 authored by GyDi's avatar GyDi Committed by GitHub
Browse files

fix: parse log cause panic

parent 0cb802ed
No related branches found
No related tags found
No related merge requests found
...@@ -55,10 +55,13 @@ fn clash_client_info() -> Result<(String, HeaderMap)> { ...@@ -55,10 +55,13 @@ fn clash_client_info() -> Result<(String, HeaderMap)> {
/// 缩短clash的日志 /// 缩短clash的日志
pub fn parse_log(log: String) -> String { pub fn parse_log(log: String) -> String {
if log.starts_with("time=") { if log.starts_with("time=") && log.len() > 33 {
return (&log[33..]).to_owned(); return (&log[33..]).to_owned();
} }
(&log[9..]).to_owned() if log.len() > 9 {
return (&log[9..]).to_owned();
}
return log;
} }
/// 缩短clash -t的错误输出 /// 缩短clash -t的错误输出
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment