message helper now handles empty responses more gracefully

This commit is contained in:
Valerie Wolfe 2024-07-22 10:18:10 -04:00
parent 0fe3906578
commit 8e2826b110

View file

@ -26,7 +26,8 @@ pub fn message(fstr: &str) -> Option<String> {
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 }
}