joy.cpl: Prevent crash on IDirectInputEffect_Release.
This commit is contained in:
parent
cda7633775
commit
e3af37eb1c
|
@ -90,6 +90,7 @@ static BOOL CALLBACK enum_callback(const DIDEVICEINSTANCEW *instance, void *cont
|
|||
joystick->num_buttons = caps.dwButtons;
|
||||
joystick->num_axes = caps.dwAxes;
|
||||
joystick->forcefeedback = caps.dwFlags & DIDC_FORCEFEEDBACK;
|
||||
joystick->num_effects = 0;
|
||||
|
||||
if (joystick->forcefeedback) data->num_ff++;
|
||||
|
||||
|
@ -130,7 +131,7 @@ static void destroy_joysticks(struct JoystickData *data)
|
|||
for (i = 0; i < data->num_joysticks; i++)
|
||||
{
|
||||
|
||||
if (data->joysticks[i].forcefeedback)
|
||||
if (data->joysticks[i].forcefeedback && data->joysticks[i].num_effects > 0)
|
||||
{
|
||||
for (j = 0; j < data->joysticks[i].num_effects; j++)
|
||||
IDirectInputEffect_Release(data->joysticks[i].effects[j].effect);
|
||||
|
|
Loading…
Reference in New Issue