diff --git a/accessible/xpcom/xpcAccessible.cpp b/accessible/xpcom/xpcAccessible.cpp index 66abcc7cfd6..76e01bf4acf 100644 --- a/accessible/xpcom/xpcAccessible.cpp +++ b/accessible/xpcom/xpcAccessible.cpp @@ -23,6 +23,7 @@ NS_IMETHODIMP xpcAccessible::GetParent(nsIAccessible** aParent) { NS_ENSURE_ARG_POINTER(aParent); + *aParent = nullptr; if (!Intl()) return NS_ERROR_FAILURE; @@ -146,6 +147,10 @@ NS_IMETHODIMP xpcAccessible::GetIndexInParent(int32_t* aIndexInParent) { NS_ENSURE_ARG_POINTER(aIndexInParent); + *aIndexInParent = -1; + + if (!Intl()) + return NS_ERROR_FAILURE; *aIndexInParent = Intl()->IndexInParent(); return *aIndexInParent != -1 ? NS_OK : NS_ERROR_FAILURE; @@ -157,6 +162,9 @@ xpcAccessible::GetDOMNode(nsIDOMNode** aDOMNode) NS_ENSURE_ARG_POINTER(aDOMNode); *aDOMNode = nullptr; + if (!Intl()) + return NS_ERROR_FAILURE; + nsINode* node = Intl()->GetNode(); if (node) CallQueryInterface(node, aDOMNode); @@ -168,6 +176,10 @@ NS_IMETHODIMP xpcAccessible::GetDocument(nsIAccessibleDocument** aDocument) { NS_ENSURE_ARG_POINTER(aDocument); + *aDocument = nullptr; + + if (!Intl()) + return NS_ERROR_FAILURE; NS_IF_ADDREF(*aDocument = ToXPCDocument(Intl()->Document())); return NS_OK; @@ -177,6 +189,10 @@ NS_IMETHODIMP xpcAccessible::GetRootDocument(nsIAccessibleDocument** aRootDocument) { NS_ENSURE_ARG_POINTER(aRootDocument); + *aRootDocument = nullptr; + + if (!Intl()) + return NS_ERROR_FAILURE; NS_IF_ADDREF(*aRootDocument = ToXPCDocument(Intl()->RootAccessible())); return NS_OK; @@ -199,7 +215,7 @@ NS_IMETHODIMP xpcAccessible::GetState(uint32_t* aState, uint32_t* aExtraState) { NS_ENSURE_ARG_POINTER(aState); - + if (!Intl()) nsAccUtils::To32States(states::DEFUNCT, aState, aExtraState); else