Browse Source

Don't crash when querying hash when hash is empty (#3366)

Co-authored-by: Adam Yang <[email protected]>
Adam Yang 4 years ago
parent
commit
2f40325448
1 changed files with 3 additions and 1 deletions
  1. 3 1
      tools/clang/tools/dxcompiler/dxcpdbutils.cpp

+ 3 - 1
tools/clang/tools/dxcompiler/dxcpdbutils.cpp

@@ -398,7 +398,9 @@ public:
   virtual HRESULT STDMETHODCALLTYPE GetHash(_COM_Outptr_ IDxcBlob **ppResult) override {
     if (!ppResult) return E_POINTER;
     *ppResult = nullptr;
-    return m_HashBlob.QueryInterface(ppResult);
+    if (m_HashBlob)
+      return m_HashBlob.QueryInterface(ppResult);
+    return E_FAIL;
   }
 
   virtual HRESULT STDMETHODCALLTYPE GetName(_Outptr_result_z_ BSTR *pResult) override {