From 337b673e0299304876f116b9084e873187305133 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Tue, 18 Jan 2022 21:03:26 -0500 Subject: [PATCH] Tolerate null picture_url in response --- src/nexus_api/game_mod.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/nexus_api/game_mod.rs b/src/nexus_api/game_mod.rs index d1a8516..35d6348 100644 --- a/src/nexus_api/game_mod.rs +++ b/src/nexus_api/game_mod.rs @@ -82,11 +82,10 @@ impl ModResponse { .as_str() .expect("Failed to parse description in mod response") }); - let thumbnail_link = self.json.get("picture_url").map(|thumbnail_link| { - thumbnail_link - .as_str() - .expect("Failed to parse picture_url in mod response") - }); + let thumbnail_link = self + .json + .get("picture_url") + .and_then(|thumbnail_link| thumbnail_link.as_str()); let user = self.json.get("user").expect("Missing user in mod response"); let author_name = user .get("name")