From 8e2826b1102483e2f63c109ccff1dc59c03f9fe7 Mon Sep 17 00:00:00 2001 From: Valerie Date: Mon, 22 Jul 2024 10:18:10 -0400 Subject: [PATCH] message helper now handles empty responses more gracefully --- src/util.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util.rs b/src/util.rs index dbaa1d1..1f5f183 100644 --- a/src/util.rs +++ b/src/util.rs @@ -26,7 +26,8 @@ pub fn message(fstr: &str) -> Option { if let Ok(output) = result { let text = String::from_utf8(output.0.stdout); if let Ok(title) = text { - Some(title[0..title.len() - 1].to_owned()) + if title.len() > 0 { Some(title[0..title.len() - 1].to_owned()) } + else { None } } else { None } } else { None } }