From 520a24ca3fa0bd930e3f8c72fbb56a02d30ac70a Mon Sep 17 00:00:00 2001 From: "mats.palmgren@bredband.net" Date: Thu, 17 May 2007 01:21:49 -0700 Subject: [PATCH] Null-check the primary frame before using it. b=380749 r=aaronleventhal --- accessible/src/html/nsHTMLTableAccessible.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/accessible/src/html/nsHTMLTableAccessible.cpp b/accessible/src/html/nsHTMLTableAccessible.cpp index fa5cfbc69a3..667feb82593 100644 --- a/accessible/src/html/nsHTMLTableAccessible.cpp +++ b/accessible/src/html/nsHTMLTableAccessible.cpp @@ -239,7 +239,9 @@ nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption) NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr captionNode(do_QueryInterface(caption)); - NS_ENSURE_TRUE(captionNode, NS_ERROR_FAILURE); + if (!captionNode) { + return NS_OK; + } nsCOMPtr accService = GetAccService(); NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE); @@ -252,6 +254,9 @@ nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption) nsCOMPtr content(do_QueryInterface(captionNode)); NS_ENSURE_TRUE(presShell && content, NS_ERROR_FAILURE); nsIFrame* frame = presShell->GetPrimaryFrameFor(content); + if (!frame) { + return NS_OK; + } accService->CreateHyperTextAccessible(frame, aCaption); nsCOMPtr accessNode(do_QueryInterface(*aCaption)); return accessNode ? accessNode->Init() : NS_ERROR_FAILURE; @@ -953,7 +958,9 @@ NS_IMETHODIMP nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForL NS_ENSURE_TRUE(cellContent, NS_ERROR_FAILURE); nsCOMPtr shell(GetPresShell()); nsIFrame *cellFrame = shell->GetPrimaryFrameFor(cellContent); - NS_ENSURE_TRUE(cellFrame, NS_ERROR_FAILURE); + if (!cellFrame) { + return NS_OK; + } nsMargin border; cellFrame->GetBorder(border); if (border.top && border.bottom && border.left && border.right) {