diff --git a/src/position.rs b/src/position.rs index 1b946c9..f34d5de 100644 --- a/src/position.rs +++ b/src/position.rs @@ -9,6 +9,11 @@ impl From for Position { // e.g. "2,5" let xy: Vec<&str> = string.split(',').collect(); let x = xy[0].parse().unwrap(); + + if xy.len() < 2 { + panic!("Bad position : {}", string); + } + let y = xy[1].parse().unwrap(); Position { x, y }