os2joystick: fix uninitialized use of local var 'maxdevs'

This commit is contained in:
Ozkan Sezer 2022-01-09 20:33:32 +03:00
parent 17da60068d
commit b9d98331c5
1 changed files with 1 additions and 0 deletions

View File

@ -184,6 +184,7 @@ static int OS2_JoystickInit(void)
joyPortClose(&hJoyPort);
return SDL_SetError("Could not read joystick port.");
}
maxdevs = 0;
if (stGameParms.useA != 0) maxdevs++;
if (stGameParms.useB != 0) maxdevs++;
if (maxdevs > MAX_JOYSTICKS) maxdevs = MAX_JOYSTICKS;