Made it not crash

This commit is contained in:
vanten-s 2023-10-20 10:35:09 +02:00
parent 9406f7725e
commit 08478b53d0
Signed by: vanten-s
GPG key ID: DE3060396884D3F2

View file

@ -179,7 +179,10 @@ pub fn parse(text: &str) -> ParseResult<VecDeque<Line>> {
}
// 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;