ao_wasapi: fix crash on hotplug init error

On init error, the mp_msg macros are actually called. They could cause
a crash because state->log was NULL.
This commit is contained in:
wm4 2015-06-17 13:42:31 +02:00
parent 762623cdef
commit d4aaf29a05
1 changed files with 1 additions and 0 deletions

View File

@ -390,6 +390,7 @@ static int hotplug_init(struct ao *ao)
{ {
MP_DBG(ao, "Hotplug init\n"); MP_DBG(ao, "Hotplug init\n");
struct wasapi_state *state = ao->priv; struct wasapi_state *state = ao->priv;
state->log = ao->log;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
HRESULT hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, HRESULT hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
&IID_IMMDeviceEnumerator, (void **)&state->pEnumerator); &IID_IMMDeviceEnumerator, (void **)&state->pEnumerator);