From 2e69cfe104e8f98dded280d6715ac43103c68926 Mon Sep 17 00:00:00 2001 From: Andrey Golovizin Date: Thu, 1 Jul 2021 12:05:21 +0200 Subject: [PATCH] Fix check when not connected --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 733fd4b..54e8142 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,7 +63,7 @@ struct Locations { struct CheckResult { connected: bool, ip: String, // XXX - location: String, + location: Option, } #[derive(Serialize, Deserialize, Debug)] @@ -161,7 +161,9 @@ fn check(opts: &Opts) -> Result<(), anyhow::Error> { } else { println!("Connected: {:?}", result.connected); println!("IP: {}", result.ip); - println!("Location: {}", result.location); + if let Some(location) = result.location { + println!("Location: {}", location); + } } Ok(()) }