Fix check when not connected

This commit is contained in:
Andrey Golovizin 2021-07-01 12:05:21 +02:00
parent c77ecbfe5d
commit 2e69cfe104

View file

@ -63,7 +63,7 @@ struct Locations {
struct CheckResult { struct CheckResult {
connected: bool, connected: bool,
ip: String, // XXX ip: String, // XXX
location: String, location: Option<String>,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
@ -161,7 +161,9 @@ fn check(opts: &Opts) -> Result<(), anyhow::Error> {
} else { } else {
println!("Connected: {:?}", result.connected); println!("Connected: {:?}", result.connected);
println!("IP: {}", result.ip); println!("IP: {}", result.ip);
println!("Location: {}", result.location); if let Some(location) = result.location {
println!("Location: {}", location);
}
} }
Ok(()) Ok(())
} }