return error instead of panicking on sprite missing position
This commit is contained in:
parent
eede24b13c
commit
1967be3635
|
@ -84,7 +84,11 @@ impl Sprite {
|
|||
return Err(SpriteMissingRoomPosition);
|
||||
}
|
||||
|
||||
position = Some(Position::from_str(room_position[1]).unwrap());
|
||||
if let Ok(pos) = Position::from_str(room_position[1]) {
|
||||
position = Some(pos);
|
||||
} else {
|
||||
return Err(SpriteMissingRoomPosition);
|
||||
}
|
||||
} else if last_line.starts_with("COL") {
|
||||
colour_id = Some(last_line.replace("COL ", "").parse().unwrap());
|
||||
} else if last_line.starts_with("ITM") {
|
||||
|
|
Loading…
Reference in New Issue