From 64cd388aeb3b5b54ff4eb112123190cca9216e8b Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sat, 21 Oct 2017 08:12:28 +0300 Subject: [PATCH] Messy fix unti we got url sanitization. Fixed a bug where program would panic if the Get Request to where the feed image is would fail. --- hammond-downloader/src/downloader.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hammond-downloader/src/downloader.rs b/hammond-downloader/src/downloader.rs index 4fb84e9..0bf127a 100644 --- a/hammond-downloader/src/downloader.rs +++ b/hammond-downloader/src/downloader.rs @@ -158,7 +158,12 @@ pub fn cache_image(title: &str, image_uri: Option<&str>) -> Option { return Some(dlpath); } - download_to(&dlpath, url).unwrap(); + if let Err(err) = download_to(&dlpath, url) { + error!("Failed to get feed image."); + error!("Error: {}", err); + return None; + }; + info!("Cached img into: {}", dlpath); return Some(dlpath); }