This prevents a possible crash in CreateDeviceEx when using faulty
response from GetAdapterDisplayModeEx and allows ffmpeg to fallback to
classic d3d9.
Signed-off-by: wm4 <nfxjfg@googlemail.com>
if (FAILED(hr))
return AVERROR_UNKNOWN;
- IDirect3D9Ex_GetAdapterDisplayModeEx(d3d9ex, adapter, &modeex, NULL);
+ hr = IDirect3D9Ex_GetAdapterDisplayModeEx(d3d9ex, adapter, &modeex, NULL);
+ if (FAILED(hr)) {
+ IDirect3D9Ex_Release(d3d9ex);
+ return AVERROR_UNKNOWN;
+ }
d3dpp.BackBufferFormat = modeex.Format;