[orca/570658] Handle case where parent == None
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca/570658] Handle case where parent == None
- Date: Thu, 21 May 2009 05:24:10 -0400 (EDT)
commit b98e2808804350c3fe4b1d3c092db6dffcf9d857
Author: Willie Walker <william walker sun com>
Date: Thu May 21 05:21:44 2009 -0400
Handle case where parent == None
This came up when testing the horrible combobox on the Orca WIKI.
The combobox on the WIKI is useless (we cannot get to the data),
but this at least prevent tracebacks when dealing with it.
---
src/orca/scripts/toolkits/Gecko/script.py | 2 +-
src/orca/speechgenerator.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 6ea5ee9..e1f79e1 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -3603,7 +3603,7 @@ class Script(default.Script):
this value is 0-based (Gecko return is 1-based) """
if obj is None or obj.getRole() == pyatspi.ROLE_HEADING \
- or obj.parent.getRole() == pyatspi.ROLE_MENU:
+ or (obj.parent and obj.parent.getRole() == pyatspi.ROLE_MENU):
return -1
try:
diff --git a/src/orca/speechgenerator.py b/src/orca/speechgenerator.py
index 9be3b9f..5ac0c14 100644
--- a/src/orca/speechgenerator.py
+++ b/src/orca/speechgenerator.py
@@ -416,7 +416,7 @@ class SpeechGenerator:
priorParent = None
if (obj.getRole() == pyatspi.ROLE_TABLE_CELL) \
- or (obj.parent.getRole() == pyatspi.ROLE_TABLE):
+ or (obj.parent and obj.parent.getRole() == pyatspi.ROLE_TABLE):
try:
table = priorParent.queryTable()
except:
@@ -496,7 +496,7 @@ class SpeechGenerator:
priorParent = None
if (obj.getRole() == pyatspi.ROLE_TABLE_CELL) \
- or (obj.parent.getRole() == pyatspi.ROLE_TABLE):
+ or (obj.parent and obj.parent.getRole() == pyatspi.ROLE_TABLE):
try:
table = priorParent.queryTable()
except:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]