Skip to content

Commit 751550e

Browse files
committed
Throw JsonReaderException when unable to find shortcut type
1 parent daaab83 commit 751550e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Source/MultiFunPlayer/Settings/Converters/ShortcutConverter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ public override IShortcut ReadJson(JsonReader reader, Type objectType, IShortcut
1818
if (!o[nameof(IShortcut.Gesture)].TryToObject<TypedValue>(out var gesture))
1919
throw new JsonReaderException("Failed to instanciate gesture descriptor");
2020

21-
var instance = shortcutFactory.CreateShortcut(o.GetTypeProperty(), (IInputGestureDescriptor)gesture.Value);
21+
var type = o.GetTypeProperty()
22+
?? throw new JsonReaderException($"Failed to find shortcut type \"{o["$type"]}\"");
23+
24+
var instance = shortcutFactory.CreateShortcut(type, (IInputGestureDescriptor)gesture.Value);
2225

2326
o.Remove(nameof(IShortcut.Gesture));
2427
o.Populate(instance);

0 commit comments

Comments
 (0)