OSDN Git Service

debugger: fix QTextCursor python dumper for default-constructed objects
authorhjk <qtc-committer@nokia.com>
Wed, 13 Oct 2010 08:13:33 +0000 (10:13 +0200)
committerhjk <qtc-committer@nokia.com>
Wed, 13 Oct 2010 08:14:19 +0000 (10:14 +0200)
Reviewed-by: Friedemann Kleint
share/qtcreator/gdbmacros/gdbmacros.py

index 63b7c17..49bf406 100644 (file)
@@ -1660,14 +1660,19 @@ def qdump__QTextCodec(d, item):
 
 
 def qdump__QTextCursor(d, item):
-    p = item.value["d"]["d"].dereference()
-    d.putValue(p["position"])
-    d.putNumChild(1)
-    if d.isExpanded(item):
-        with Children(d):
-            d.putIntItem("position", p["position"])
-            d.putIntItem("anchor", p["anchor"])
-            d.putCallItem("selected", item, "selectedText()")
+    dd = item.value["d"]["d"]
+    if isNull(dd):
+        d.putValue("(invalid)")
+        d.putNumChild(0)
+    else:
+        p = dd.dereference()
+        d.putValue(p["position"])
+        d.putNumChild(1)
+        if d.isExpanded(item):
+            with Children(d):
+                d.putIntItem("position", p["position"])
+                d.putIntItem("anchor", p["anchor"])
+                d.putCallItem("selected", item, "selectedText()")
 
 
 def qdump__QTextDocument(d, item):