(Dinput joypad) Prevent input going haywire once pad is disconnected

This commit is contained in:
twinaphex 2019-07-23 18:46:40 +02:00
parent f06607141d
commit 5d8d6e18b2
1 changed files with 6 additions and 1 deletions

View File

@ -426,7 +426,12 @@ static bool dinput_joypad_init(void *data)
static bool dinput_joypad_button(unsigned port_num, uint16_t joykey)
{
const struct dinput_joypad_data *pad = &g_pads[port_num];
unsigned hat_dir = GET_HAT_DIR(joykey);
unsigned hat_dir = 0;
if (!pad || !pad->joypad)
return false;
hat_dir = GET_HAT_DIR(joykey);
if (hat_dir)
{