dmloader: Check for invalid class in EnableCache().

Fixes a test failure with sone Mingw versions.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Alexandre Julliard 2020-06-11 21:56:46 +02:00
parent f779f36da3
commit 8d12efecc9
1 changed files with 4 additions and 2 deletions

View File

@ -771,10 +771,12 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_EnableCache(IDirectMusicLoader8 *if
if (IsEqualGUID(class, &GUID_DirectMusicAllTypes)) if (IsEqualGUID(class, &GUID_DirectMusicAllTypes))
This->cache_class = enable ? ~0 : 0; This->cache_class = enable ? ~0 : 0;
else { else {
int idx = index_from_class(class);
if (idx == -1) return S_FALSE;
if (enable) if (enable)
This->cache_class |= 1 << index_from_class(class); This->cache_class |= 1 << idx;
else else
This->cache_class &= ~(1 << index_from_class(class)); This->cache_class &= ~(1 << idx);
} }
if (!enable) if (!enable)