mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-10-03 15:48:54 +02:00
misc: chore: Fix numerous NullReferenceExceptions, InvalidOperationExceptions
This commit is contained in:
@@ -510,7 +510,7 @@ namespace Ryujinx.Input.HLE
|
||||
{
|
||||
var keyboard = KeyboardDriver.GetGamepad("0") as IKeyboard;
|
||||
|
||||
KeyboardStateSnapshot keyboardState = keyboard.GetKeyboardStateSnapshot();
|
||||
KeyboardStateSnapshot keyboardState = keyboard?.GetKeyboardStateSnapshot();
|
||||
|
||||
KeyboardInput hidKeyboard = new()
|
||||
{
|
||||
@@ -520,14 +520,14 @@ namespace Ryujinx.Input.HLE
|
||||
|
||||
foreach (HLEKeyboardMappingEntry entry in _keyMapping)
|
||||
{
|
||||
ulong value = keyboardState.IsPressed(entry.TargetKey) ? 1UL : 0UL;
|
||||
ulong value = keyboardState != null && keyboardState.IsPressed(entry.TargetKey) ? 1UL : 0UL;
|
||||
|
||||
hidKeyboard.Keys[entry.Target / 0x40] |= (value << (entry.Target % 0x40));
|
||||
}
|
||||
|
||||
foreach (HLEKeyboardMappingEntry entry in _keyModifierMapping)
|
||||
{
|
||||
int value = keyboardState.IsPressed(entry.TargetKey) ? 1 : 0;
|
||||
int value = keyboardState != null && keyboardState.IsPressed(entry.TargetKey) ? 1 : 0;
|
||||
|
||||
hidKeyboard.Modifier |= value << entry.Target;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user