From 57a1a147a6b8187a830a525cdd66ad12d6d70634 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 5 Jan 2009 15:50:36 +0100 Subject: [PATCH] jscript/tests: Don't crash if we fail to get the IActiveScriptParse interface. --- dlls/jscript/tests/jscript.c | 10 ++++++++++ dlls/jscript/tests/run.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/dlls/jscript/tests/jscript.c b/dlls/jscript/tests/jscript.c index 4cc01c96abb..ac6505833d4 100644 --- a/dlls/jscript/tests/jscript.c +++ b/dlls/jscript/tests/jscript.c @@ -295,6 +295,11 @@ static void test_jscript(void) hres = IUnknown_QueryInterface(unk, &IID_IActiveScriptParse, (void**)&parse); ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres); + if (FAILED(hres)) + { + IActiveScript_Release(script); + return; + } test_state(script, SCRIPTSTATE_UNINITIALIZED); test_safety(unk); @@ -366,6 +371,11 @@ static void test_jscript2(void) hres = IUnknown_QueryInterface(unk, &IID_IActiveScriptParse, (void**)&parse); ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres); + if (FAILED(hres)) + { + IActiveScript_Release(script); + return; + } test_state(script, SCRIPTSTATE_UNINITIALIZED); diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 81de5795209..66c312ebfe9 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -574,6 +574,11 @@ static void parse_script(BSTR script_str) hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser); ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres); + if (FAILED(hres)) + { + IActiveScript_Release(engine); + return; + } hres = IActiveScriptParse_InitNew(parser); ok(hres == S_OK, "InitNew failed: %08x\n", hres); @@ -696,6 +701,11 @@ static void test_isvisible(BOOL global_members) hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser); ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres); + if (FAILED(hres)) + { + IActiveScript_Release(engine); + return; + } hres = IActiveScriptParse_InitNew(parser); ok(hres == S_OK, "InitNew failed: %08x\n", hres);