[vlc-devel] [PATCH 3/8] d3d11_fmt: don't crash on missing external ID3D11DeviceContext
    Steve Lhomme 
    robux4 at ycbcr.xyz
       
    Wed Mar 31 06:25:23 UTC 2021
    
    
  
---
 modules/video_chroma/d3d11_fmt.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index ec89837b780..988cf98fd75 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -322,6 +322,12 @@ void D3D11_ReleaseDevice(d3d11_decoder_device_t *dev_sys)
 static HRESULT D3D11_CreateDeviceExternal(vlc_object_t *obj, ID3D11DeviceContext *d3d11ctx,
                                    bool hw_decoding, d3d11_device_t *out)
 {
+    if (unlikely(d3d11ctx == NULL))
+    {
+        msg_Err(obj, "missing external ID3D11DeviceContext");
+        return S_FALSE;
+    }
+
     HRESULT hr;
     ID3D11DeviceContext_GetDevice( d3d11ctx, &out->d3ddevice );
 
-- 
2.29.2
    
    
More information about the vlc-devel
mailing list