Index: src/orca/Gecko.py
===================================================================
--- src/orca/Gecko.py	(revision 2698)
+++ src/orca/Gecko.py	(working copy)
@@ -5039,9 +5039,14 @@
         of 0 means there is no heading level."""
 
         level = 0
+        
+        if obj is None:
+            return level
 
         if obj.role == rolenames.ROLE_HEADING:
             attributes = obj.attributes
+            if attributes is None:
+                return level
             for attribute in attributes:
                 if attribute.startswith("level:"):
                     level = int(attribute.split(":")[1])
@@ -5054,7 +5059,12 @@
         object attribute 'level'.  To be consistent with default.getNodeLevel()
         this value is 0-based (Gecko return is 1-based) """
         
+        if obj is None:
+            return -1
+        
         attrs = obj.attributes
+        if attrs is None:
+            return -1
         for attr in attrs:
             if attr.startswith("level:"):
                 return int(attr[6:]) - 1
