From d8268565a4a8b3ee4dcb8fd43cb206ca80e7e00c Mon Sep 17 00:00:00 2001 From: blank X Date: Tue, 19 Jan 2021 14:28:01 +0700 Subject: [PATCH] Handle existing English and Japanese titles but empty --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/structs.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 072dc9f..a585d4e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -389,7 +389,7 @@ dependencies = [ [[package]] name = "nhentairs" -version = "0.5.3" +version = "0.5.4" dependencies = [ "reqwest", "serde", diff --git a/Cargo.toml b/Cargo.toml index 95b0c5e..50f4e97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nhentairs" -version = "0.5.3" +version = "0.5.4" authors = ["blank X "] edition = "2018" diff --git a/src/structs.rs b/src/structs.rs index ed7e33a..7c02b89 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -72,9 +72,9 @@ impl fmt::Display for GalleryInfoSuccess { let mut text = format!("Sauce: {}\nTitle: ", self.id); let japanese_title = self.title.japanese.as_ref(); let english_title = self.title.english.as_ref(); - if english_title.is_some() { + if english_title.filter(|i| !i.is_empty()).is_some() { text.push_str(english_title.unwrap()); - if japanese_title.is_some() { + if japanese_title.filter(|i| !i.is_empty()).is_some() { text.push_str(&format!("\nJapanese Title: {}", japanese_title.unwrap())); } } else {