From 5c81677643fbd203da02b3f2c176ebf7cd1a00af Mon Sep 17 00:00:00 2001 From: FieldofClay <7278759+FieldofClay@users.noreply.github.com> Date: Mon, 15 May 2023 21:00:45 +1000 Subject: [PATCH] Add check for valid monitor --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.rs b/src/main.rs index e3561d4..3d29af0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,6 +40,12 @@ fn main() -> Result<()> { std::process::exit(0); } let mon = args[1].to_string(); + if let None = Monitors::get() + .expect("unable to get monitors") + .find(|m| m.name == mon) { + println!("Unable to find monitor {mon}"); + std::process::exit(0); + } print_title(&mon); // Create a event listener let mut event_listener = EventListener::new();