From 39652c02aab013eb387c2453788cc071e53b55c7 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Wed, 14 Aug 2013 09:11:13 -0500 Subject: [PATCH] Bug 905058 - Before accessing the UIA root element make sure the global com ptr is populated. r=bbondy --- widget/windows/winrt/MetroWidget.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/widget/windows/winrt/MetroWidget.cpp b/widget/windows/winrt/MetroWidget.cpp index a629901126aa..854430232f01 100644 --- a/widget/windows/winrt/MetroWidget.cpp +++ b/widget/windows/winrt/MetroWidget.cpp @@ -686,16 +686,17 @@ MetroWidget::WindowProcedure(HWND aWnd, UINT aMsg, WPARAM aWParam, LPARAM aLPara // UiaReturnRawElementProvider passing the return result from FrameworkView // OnAutomationProviderRequested as the hwnd (me scratches head) which results in // GetLastError always being set to invalid handle (6) after CallWindowProc returns. - if (dwObjId == UiaRootObjectId) { - NS_ASSERTION(gProviderRoot.Get(), "gProviderRoot is null??"); + if (dwObjId == UiaRootObjectId && gProviderRoot) { ComPtr simple; gProviderRoot.As(&simple); - LRESULT res = UiaReturnRawElementProvider(aWnd, aWParam, aLParam, simple.Get()); - if (res) { - return res; + if (simple) { + LRESULT res = UiaReturnRawElementProvider(aWnd, aWParam, aLParam, simple.Get()); + if (res) { + return res; + } + NS_ASSERTION(res, "UiaReturnRawElementProvider failed!"); + Log("UiaReturnRawElementProvider failed! GetLastError=%X", GetLastError()); } - NS_ASSERTION(res, "UiaReturnRawElementProvider failed!"); - Log("UiaReturnRawElementProvider failed! GetLastError=%X", GetLastError()); } break; }