From cc98dca77e5f8774baf5a5c6c015c27605a0dc21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Thu, 1 Oct 2015 08:40:35 +0200 Subject: [PATCH] Bug 1210023 - Fix accessibilityAttributeValue for NSAccessibilityIndexAttribute. r=surkov, a=lizzard --HG-- extra : source : 860c5decce249dfb052b79990417bd95a0c9f94a --- accessible/mac/mozAccessible.mm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/accessible/mac/mozAccessible.mm b/accessible/mac/mozAccessible.mm index d25d0a2d69d8..601d927d2fd4 100644 --- a/accessible/mac/mozAccessible.mm +++ b/accessible/mac/mozAccessible.mm @@ -453,9 +453,12 @@ ConvertToNSArray(nsTArray& aArray) if ([attribute isEqualToString:NSAccessibilityIndexAttribute]) { // Count the number of rows before that one to obtain the row index. uint32_t index = 0; - for (int32_t i = accWrap->IndexInParent() - 1; i >= 0; i--) { - if (accWrap->GetChildAt(i)->IsTableRow()) { - index++; + Accessible* parent = accWrap->Parent(); + if (parent) { + for (int32_t i = accWrap->IndexInParent() - 1; i >= 0; i--) { + if (parent->GetChildAt(i)->IsTableRow()) { + index++; + } } } return [NSNumber numberWithUnsignedInteger:index]; @@ -503,9 +506,12 @@ ConvertToNSArray(nsTArray& aArray) if ([attribute isEqualToString:NSAccessibilityIndexAttribute]) { // Count the number of rows before that one to obtain the row index. uint32_t index = 0; - for (int32_t i = proxy->IndexInParent() - 1; i >= 0; i--) { - if (proxy->ChildAt(i)->IsTableRow()) { - index++; + ProxyAccessible* parent = proxy->Parent(); + if (parent) { + for (int32_t i = proxy->IndexInParent() - 1; i >= 0; i--) { + if (parent->ChildAt(i)->IsTableRow()) { + index++; + } } } return [NSNumber numberWithUnsignedInteger:index];