summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.Web
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-09-22 02:00:15 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-09-22 02:00:15 -0400
commit7d703c9c5ca76a99fc3d430fa2b3fd22301a5ffb (patch)
tree5803b8a66a06f0f82bc5c091087c229c23ad4573 /src/StardewModdingAPI.Web
parent86e55596786f8d65854a75632512750b6e09faae (diff)
downloadSMAPI-7d703c9c5ca76a99fc3d430fa2b3fd22301a5ffb.tar.gz
SMAPI-7d703c9c5ca76a99fc3d430fa2b3fd22301a5ffb.tar.bz2
SMAPI-7d703c9c5ca76a99fc3d430fa2b3fd22301a5ffb.zip
handle invalid Nexus mod IDs (#336)
Diffstat (limited to 'src/StardewModdingAPI.Web')
-rw-r--r--src/StardewModdingAPI.Web/Framework/ModRepositories/NexusRepository.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/StardewModdingAPI.Web/Framework/ModRepositories/NexusRepository.cs b/src/StardewModdingAPI.Web/Framework/ModRepositories/NexusRepository.cs
index 74eef2ef..7e3ce4b6 100644
--- a/src/StardewModdingAPI.Web/Framework/ModRepositories/NexusRepository.cs
+++ b/src/StardewModdingAPI.Web/Framework/ModRepositories/NexusRepository.cs
@@ -42,7 +42,10 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
NexusResponseModel response = await this.Client
.GetAsync($"mods/{id}")
.As<NexusResponseModel>();
- return new ModInfoModel($"{this.VendorKey}:{id}", response.Name, response.Version, response.Url);
+
+ return response != null
+ ? new ModInfoModel($"{this.VendorKey}:{id}", response.Name, response.Version, response.Url)
+ : new ModInfoModel($"{this.VendorKey}:{id}", "Found no mod with this ID.");
}
catch (Exception ex)
{