summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Serialization/KeybindConverter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework/Serialization/KeybindConverter.cs')
-rw-r--r--src/SMAPI/Framework/Serialization/KeybindConverter.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/SMAPI/Framework/Serialization/KeybindConverter.cs b/src/SMAPI/Framework/Serialization/KeybindConverter.cs
index 93a274a8..539f1291 100644
--- a/src/SMAPI/Framework/Serialization/KeybindConverter.cs
+++ b/src/SMAPI/Framework/Serialization/KeybindConverter.cs
@@ -36,7 +36,7 @@ namespace StardewModdingAPI.Framework.Serialization
/// <param name="objectType">The object type.</param>
/// <param name="existingValue">The object being read.</param>
/// <param name="serializer">The calling serializer.</param>
- public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+ public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
{
string path = reader.Path;
@@ -44,7 +44,7 @@ namespace StardewModdingAPI.Framework.Serialization
{
case JsonToken.Null:
return objectType == typeof(Keybind)
- ? (object)new Keybind()
+ ? new Keybind()
: new KeybindList();
case JsonToken.String:
@@ -53,13 +53,13 @@ namespace StardewModdingAPI.Framework.Serialization
if (objectType == typeof(Keybind))
{
- return Keybind.TryParse(str, out Keybind parsed, out string[] errors)
+ return Keybind.TryParse(str, out Keybind? parsed, out string[] errors)
? parsed
: throw new SParseException($"Can't parse {nameof(Keybind)} from invalid value '{str}' (path: {path}).\n{string.Join("\n", errors)}");
}
else
{
- return KeybindList.TryParse(str, out KeybindList parsed, out string[] errors)
+ return KeybindList.TryParse(str, out KeybindList? parsed, out string[] errors)
? parsed
: throw new SParseException($"Can't parse {nameof(KeybindList)} from invalid value '{str}' (path: {path}).\n{string.Join("\n", errors)}");
}
@@ -74,7 +74,7 @@ namespace StardewModdingAPI.Framework.Serialization
/// <param name="writer">The JSON writer.</param>
/// <param name="value">The value.</param>
/// <param name="serializer">The calling serializer.</param>
- public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
writer.WriteValue(value?.ToString());
}