Skip to content

Commit

Permalink
Fix crash on keymap.js files which fail to parse #159
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeltris committed Jul 22, 2021
1 parent a3e04b5 commit 899885b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions GK6X/KeyboardState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ private void LoadKeys()
if (File.Exists(keysPath))
{
List<object> deviceKeys = Json.Deserialize(File.ReadAllText(keysPath)) as List<object>;
if (deviceKeys == null)
{
Debug.WriteLine("[WARNING] Failed to parse json '" + keysPath + "'");
return;
}
foreach (object deviceKeyObj in deviceKeys)
{
Dictionary<string, object> deviceKey = deviceKeyObj as Dictionary<string, object>;
Expand Down

0 comments on commit 899885b

Please sign in to comment.