From e82b0b71f90788da7049a3d3695de9cb0f0164e7 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 9 Mar 2023 11:08:05 +0100 Subject: fail with error message instead of panic --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 7e0f013..be73856 100644 --- a/src/main.rs +++ b/src/main.rs @@ -90,6 +90,12 @@ fn wg_dump(config: &Config) -> Result<(Pubkey, u16, Vec<(Pubkey, Option>(); + if ourself.len() < 3 { + bail!( + "Unable to fetch wireguard status for interface {}", + config.interface + ); + } let our_pubkey = ourself[1].to_string(); let listen_port = ourself[2].parse::()?; -- cgit v1.2.3