Commit 0c336823 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32: Handle null argument in OleIsRunning().

parent 032c3743
...@@ -2628,15 +2628,17 @@ HRESULT WINAPI OleDoAutoConvert(LPSTORAGE pStg, LPCLSID pClsidNew) ...@@ -2628,15 +2628,17 @@ HRESULT WINAPI OleDoAutoConvert(LPSTORAGE pStg, LPCLSID pClsidNew)
/****************************************************************************** /******************************************************************************
* OleIsRunning [OLE32.@] * OleIsRunning [OLE32.@]
*/ */
BOOL WINAPI OleIsRunning(LPOLEOBJECT pObject) BOOL WINAPI OleIsRunning(LPOLEOBJECT object)
{ {
IRunnableObject *pRunnable; IRunnableObject *pRunnable;
HRESULT hr; HRESULT hr;
BOOL running; BOOL running;
TRACE("(%p)\n", pObject); TRACE("(%p)\n", object);
hr = IOleObject_QueryInterface(pObject, &IID_IRunnableObject, (void **)&pRunnable); if (!object) return FALSE;
hr = IOleObject_QueryInterface(object, &IID_IRunnableObject, (void **)&pRunnable);
if (FAILED(hr)) if (FAILED(hr))
return TRUE; return TRUE;
running = IRunnableObject_IsRunning(pRunnable); running = IRunnableObject_IsRunning(pRunnable);
......
...@@ -1784,20 +1784,28 @@ static void test_runnable(void) ...@@ -1784,20 +1784,28 @@ static void test_runnable(void)
{ NULL, 0 } { NULL, 0 }
}; };
BOOL ret;
IOleObject *object = &OleObject; IOleObject *object = &OleObject;
/* null argument */
ret = OleIsRunning(NULL);
ok(ret == FALSE, "got %d\n", ret);
expected_method_list = methods_query_runnable; expected_method_list = methods_query_runnable;
ok(OleIsRunning(object), "Object should be running\n"); ret = OleIsRunning(object);
ok(ret == TRUE, "Object should be running\n");
CHECK_NO_EXTRA_METHODS(); CHECK_NO_EXTRA_METHODS();
g_isRunning = FALSE; g_isRunning = FALSE;
expected_method_list = methods_query_runnable; expected_method_list = methods_query_runnable;
ok(OleIsRunning(object) == FALSE, "Object should not be running\n"); ret = OleIsRunning(object);
ok(ret == FALSE, "Object should not be running\n");
CHECK_NO_EXTRA_METHODS(); CHECK_NO_EXTRA_METHODS();
g_showRunnable = FALSE; /* QueryInterface(IID_IRunnableObject, ...) will fail */ g_showRunnable = FALSE; /* QueryInterface(IID_IRunnableObject, ...) will fail */
expected_method_list = methods_no_runnable; expected_method_list = methods_no_runnable;
ok(OleIsRunning(object), "Object without IRunnableObject should be running\n"); ret = OleIsRunning(object);
ok(ret == TRUE, "Object without IRunnableObject should be running\n");
CHECK_NO_EXTRA_METHODS(); CHECK_NO_EXTRA_METHODS();
g_isRunning = TRUE; g_isRunning = TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment