joy.cpl: Check if effect is allocated before releasing it.

Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Tim Schumacher 2019-05-18 21:02:58 +02:00 committed by Alexandre Julliard
parent 7edbbe1ed3
commit 8bc52f5250
1 changed files with 2 additions and 1 deletions

View File

@ -137,7 +137,8 @@ static void destroy_joysticks(struct JoystickData *data)
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);
if (data->joysticks[i].effects[j].effect)
IDirectInputEffect_Release(data->joysticks[i].effects[j].effect);
HeapFree(GetProcessHeap(), 0, data->joysticks[i].effects);
}