From 7d703c9c5ca76a99fc3d430fa2b3fd22301a5ffb Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 22 Sep 2017 02:00:15 -0400 Subject: handle invalid Nexus mod IDs (#336) --- .../Framework/ModRepositories/NexusRepository.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/StardewModdingAPI.Web') 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(); - 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) { -- cgit