summaryrefslogtreecommitdiff
path: root/src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs')
-rw-r--r--src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs b/src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs
index a5237334..168b8aac 100644
--- a/src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs
+++ b/src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System;
using System.Collections.Generic;
using System.Linq;
@@ -16,7 +14,7 @@ namespace StardewModdingAPI.Toolkit.Framework.ModData
private readonly ModDataRecord[] Records;
/// <summary>Get an update URL for an update key (if valid).</summary>
- private readonly Func<string, string> GetUpdateUrl;
+ private readonly Func<string, string?> GetUpdateUrl;
/*********
@@ -29,7 +27,7 @@ namespace StardewModdingAPI.Toolkit.Framework.ModData
/// <summary>Construct an instance.</summary>
/// <param name="records">The underlying mod data records indexed by default display name.</param>
/// <param name="getUpdateUrl">Get an update URL for an update key (if valid).</param>
- public ModDatabase(IEnumerable<ModDataRecord> records, Func<string, string> getUpdateUrl)
+ public ModDatabase(IEnumerable<ModDataRecord> records, Func<string, string?> getUpdateUrl)
{
this.Records = records.ToArray();
this.GetUpdateUrl = getUpdateUrl;
@@ -43,7 +41,7 @@ namespace StardewModdingAPI.Toolkit.Framework.ModData
/// <summary>Get a mod data record.</summary>
/// <param name="modID">The unique mod ID.</param>
- public ModDataRecord Get(string modID)
+ public ModDataRecord? Get(string? modID)
{
return !string.IsNullOrWhiteSpace(modID)
? this.Records.FirstOrDefault(p => p.HasID(modID))
@@ -52,11 +50,11 @@ namespace StardewModdingAPI.Toolkit.Framework.ModData
/// <summary>Get the mod page URL for a mod (if available).</summary>
/// <param name="id">The unique mod ID.</param>
- public string GetModPageUrlFor(string id)
+ public string? GetModPageUrlFor(string? id)
{
// get update key
- ModDataRecord record = this.Get(id);
- ModDataField updateKeyField = record?.Fields.FirstOrDefault(p => p.Key == ModDataFieldKey.UpdateKey);
+ ModDataRecord? record = this.Get(id);
+ ModDataField? updateKeyField = record?.Fields.FirstOrDefault(p => p.Key == ModDataFieldKey.UpdateKey);
if (updateKeyField == null)
return null;