From 899885b5dd27e5a734806378bdaa344dfac1b65f Mon Sep 17 00:00:00 2001 From: pixeltris <6952411+pixeltris@users.noreply.github.com> Date: Thu, 22 Jul 2021 09:47:29 +0100 Subject: [PATCH] Fix crash on keymap.js files which fail to parse #159 --- GK6X/KeyboardState.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GK6X/KeyboardState.cs b/GK6X/KeyboardState.cs index a124d75..8ce5bd9 100644 --- a/GK6X/KeyboardState.cs +++ b/GK6X/KeyboardState.cs @@ -243,6 +243,11 @@ private void LoadKeys() if (File.Exists(keysPath)) { List deviceKeys = Json.Deserialize(File.ReadAllText(keysPath)) as List; + if (deviceKeys == null) + { + Debug.WriteLine("[WARNING] Failed to parse json '" + keysPath + "'"); + return; + } foreach (object deviceKeyObj in deviceKeys) { Dictionary deviceKey = deviceKeyObj as Dictionary;