Check return value of GetMethodProps() method
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Wed, 13 Jun 2018 18:01:59 +0000 (21:01 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Wed, 13 Jun 2018 18:01:59 +0000 (21:01 +0300)
src/debug/netcoredbg/jmc.cpp
src/debug/netcoredbg/typeprinter.cpp

index 1e190242137678816b6f656b44d5dea7e1620d02..7d526df945645cee4e3764a22e4805e96dd3b050 100644 (file)
@@ -144,6 +144,9 @@ static HRESULT GetNonJMCMethodsForTypeDef(
                                      szFunctionName, _countof(szFunctionName), &nameLen,
                                      nullptr, nullptr, nullptr, nullptr, nullptr);
 
+        if (FAILED(Status))
+            continue;
+
         if ((g_operatorMethodNames.find(to_utf8(szFunctionName)) != g_operatorMethodNames.end())
             || HasAttribute(pMD, methodDef, g_nonUserCode)
             || HasAttribute(pMD, methodDef, g_stepThrough)
index 7fc92bed0403b7a4c84301c61d91568b469ca1f2..6882c8bc29b0c6f37c6c35fef6ab7f53f107af17 100644 (file)
@@ -771,9 +771,9 @@ HRESULT TypePrinter::GetTypeAndMethod(ICorDebugFrame *pFrame, std::string &typeN
     ToRelease<IMetaDataImport2> pMD2;
     IfFailRet(pMDUnknown->QueryInterface(IID_IMetaDataImport2, (LPVOID*) &pMD2));
 
-    hr = pMD->GetMethodProps(methodDef, &memTypeDef,
-                             szFunctionName, _countof(szFunctionName), &nameLen,
-                             &flags, &pbSigBlob, &ulSigBlob, &ulCodeRVA, &ulImplFlags);
+    IfFailRet(pMD->GetMethodProps(methodDef, &memTypeDef,
+                                  szFunctionName, _countof(szFunctionName), &nameLen,
+                                  &flags, &pbSigBlob, &ulSigBlob, &ulCodeRVA, &ulImplFlags));
 
     std::string funcName = to_utf8(szFunctionName/*, nameLen*/);