Tolerate null picture_url in response

This commit is contained in:
Tyler Hallada 2022-01-18 21:03:26 -05:00
parent d48e2fdb5f
commit 337b673e02

View File

@ -82,11 +82,10 @@ impl ModResponse {
.as_str() .as_str()
.expect("Failed to parse description in mod response") .expect("Failed to parse description in mod response")
}); });
let thumbnail_link = self.json.get("picture_url").map(|thumbnail_link| { let thumbnail_link = self
thumbnail_link .json
.as_str() .get("picture_url")
.expect("Failed to parse picture_url in mod response") .and_then(|thumbnail_link| thumbnail_link.as_str());
});
let user = self.json.get("user").expect("Missing user in mod response"); let user = self.json.get("user").expect("Missing user in mod response");
let author_name = user let author_name = user
.get("name") .get("name")