diff --git a/src/client.rs b/src/client.rs index 54ac97f..381da9f 100644 --- a/src/client.rs +++ b/src/client.rs @@ -102,7 +102,7 @@ pub fn convert_largest_square_image_in_ico_to_png( buf: Cursor>, output_path: &str, ) -> Result<(), std::io::Error> { - let icondir = ico::IconDir::read(buf).unwrap(); + let icondir = ico::IconDir::read(buf)?; let mut largest_size = 0; let mut largest_index = 0; @@ -115,7 +115,7 @@ pub fn convert_largest_square_image_in_ico_to_png( } } - let image = icondir.entries()[largest_index].decode().unwrap(); + let image = icondir.entries()[largest_index].decode()?; let out_file = fs::File::create(output_path).unwrap(); image.write_png(out_file) diff --git a/src/main.rs b/src/main.rs index 5b76690..93ea0c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,7 +28,11 @@ fn main() { if is_container() { start_server(ip, 39493) } else if let Some(file) = file { - client::exec(address, &file, directory.to_str().unwrap()); + if let Some(directory) = directory.to_str() { + client::exec(address, &file, directory); + } else { + notify("Invalid directory was given.", None) + } } else { notify("sakaya was called but no file was given.", None); }