diff --git a/src/lib.rs b/src/lib.rs index 7daea19..7b2bc79 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -179,7 +179,10 @@ pub fn parse(text: &str) -> ParseResult> { } // Parse command component. - let end_idx = find_index(line, ' ', idx).unwrap(); + let end_idx = match find_index(line, ' ', idx) { + Some(val) => val, + None => return Err(ParseError { details: "Couldn't find index of ' '".to_string() }), + }; let command = &line[idx..end_idx]; idx = end_idx + 1;