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 1e19024..7d526df 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 7fc92be..6882c8b 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*/);