Handle existing English and Japanese titles but empty

This commit is contained in:
blank X 2021-01-19 14:28:01 +07:00
parent c351c33898
commit d8268565a4
3 changed files with 4 additions and 4 deletions

2
Cargo.lock generated
View File

@ -389,7 +389,7 @@ dependencies = [
[[package]]
name = "nhentairs"
version = "0.5.3"
version = "0.5.4"
dependencies = [
"reqwest",
"serde",

View File

@ -1,6 +1,6 @@
[package]
name = "nhentairs"
version = "0.5.3"
version = "0.5.4"
authors = ["blank X <theblankx@protonmail.com>"]
edition = "2018"

View File

@ -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 {