diff --git a/src/main.rs b/src/main.rs index 5b40d29..6a7e06a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,11 +47,12 @@ fn main() { } fn stati(s: &str) -> String { + if s.is_empty() { return "".to_string() } // handle empty string let mut t = s.split(", ") .map( |m| m.split('|') - .map(|e| e.parse::().unwrap()) + .filter_map(|e| e.parse::().ok()) // handle invalid parse .collect::>() .chunks(3) .map(|c| (c[0],c[1],c[2]))