From 8d12efecc967a1593583713a5adcd593b9e2e299 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 11 Jun 2020 21:56:46 +0200 Subject: [PATCH] dmloader: Check for invalid class in EnableCache(). Fixes a test failure with sone Mingw versions. Signed-off-by: Alexandre Julliard --- dlls/dmloader/loader.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/dmloader/loader.c b/dlls/dmloader/loader.c index c5f5094fab5..b90584b09a0 100644 --- a/dlls/dmloader/loader.c +++ b/dlls/dmloader/loader.c @@ -771,10 +771,12 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_EnableCache(IDirectMusicLoader8 *if if (IsEqualGUID(class, &GUID_DirectMusicAllTypes)) This->cache_class = enable ? ~0 : 0; else { + int idx = index_from_class(class); + if (idx == -1) return S_FALSE; if (enable) - This->cache_class |= 1 << index_from_class(class); + This->cache_class |= 1 << idx; else - This->cache_class &= ~(1 << index_from_class(class)); + This->cache_class &= ~(1 << idx); } if (!enable)