Index: src/orca/Gecko.py
===================================================================
--- src/orca/Gecko.py	(revision 2045)
+++ src/orca/Gecko.py	(working copy)
@@ -2454,6 +2454,15 @@
             previousObj = obj.parent.child(index)
             while previousObj.childCount:
                 previousObj = previousObj.child(previousObj.childCount - 1)
+                if not isinstance(previousObj, atspi.Accessible):
+                    # Then we probably got a bogus childCount from previousObj.
+                    # It seems that when this occurs, there's at least one
+                    # child, if so, set previousObj to it.  Otherwise, set it
+                    # to the previous sibling of obj.
+                    previousObj = obj.parent.child(index).child(0)
+                    if not isinstance(previousObj, atspi.Accessible):
+                        previousObj = obj.parent.child(index-1)
+                    break
 
         return previousObj
 
@@ -2467,13 +2476,20 @@
         """
 
         nextObj = None
+        candidate = obj
 
         if obj.childCount:
             nextObj = obj.child(0)
         elif (obj.index + 1) < obj.parent.childCount:
             nextObj = obj.parent.child(obj.index + 1)
-        else:
-            candidate = obj
+            if not isinstance(nextObj, atspi.Accessible):
+                # Then we probably got a bogus childCount from obj.parent
+                # and obj is really the last child.
+                #
+                nextObj = None
+                candidate = obj.parent.parent
+
+        if not nextObj:
             while (candidate.index >= (candidate.parent.childCount - 1)) \
                 and (candidate.role != rolenames.ROLE_DOCUMENT_FRAME):
                 candidate = candidate.parent
