Disallow routing to departing station
This commit is contained in:
parent
afee3b0c6f
commit
864c94ea94
@ -194,6 +194,10 @@ async fn route_station_to_dest_station(
|
||||
return Err((StatusCode::NOT_FOUND, String::from("Unknown destination station")));
|
||||
}
|
||||
|
||||
if dest_station_id == station_id {
|
||||
return Err((StatusCode::NOT_FOUND, String::from("Cannot route to departing station as destination")));
|
||||
}
|
||||
|
||||
let station_properties = match state.stations.get(&station_id) {
|
||||
Some(v) => v,
|
||||
None => return Err((StatusCode::INTERNAL_SERVER_ERROR, String::from("Station properties for departing station missing"))),
|
||||
|
Loading…
Reference in New Issue
Block a user