diff --git a/src/main.rs b/src/main.rs index d1ae7d2..cb3ab9d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,9 +29,15 @@ fn parse_config(conf: String, pool: &mut Vec) -> Result raw, }; let mut tokens = raw_line.split_whitespace(); - let token1 = tokens.next(); - let token2 = tokens.next(); - println!("{}, {}", token1.unwrap(), token2.unwrap()); + let token1 = match tokens.next() { + None => return Err("Could not read the first token of the first line !"), + Some(raw) => raw, + }; + let token2 = match tokens.next() { + None => return Err("Could not read the second token of the first line !"), + Some(raw) => raw, + }; + println!("{}, {}", token1, token2); Ok(world::World { x: 5, y: 5 }) }