Handle QueryInterface errors
authorAndre Heinecke <aheinecke@intevation.de>
Fri, 13 Jan 2017 11:34:30 +0000 (12:34 +0100)
committerAndre Heinecke <aheinecke@intevation.de>
Fri, 13 Jan 2017 11:34:30 +0000 (12:34 +0100)
* src/oomhelp.cpp (get_oom_object): Handle QueryInterface errors.

--
Not a problem in practice but noticed that an error there is
unhandled while debugging another problem.

src/oomhelp.cpp

index 87665d2..dba6cae 100644 (file)
@@ -188,7 +188,13 @@ get_oom_object (LPDISPATCH pStart, const char *fullname)
           gpgol_release (pDisp);
           pDisp = NULL;
         }
-      pObj->QueryInterface (IID_IDispatch, (LPVOID*)&pDisp);
+      if (pObj->QueryInterface (IID_IDispatch, (LPVOID*)&pDisp) != S_OK)
+        {
+          log_error ("%s:%s Object does not support IDispatch",
+                     SRCNAME, __func__);
+          gpgol_release (pObj);
+          return NULL;
+        }
       if (pObj != pStart)
         gpgol_release (pObj);
       pObj = NULL;