From 6c788a10937da0377c770745d2d03805542b038e Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Wed, 13 Oct 2010 10:13:33 +0200
Subject: [PATCH] debugger: fix QTextCursor python dumper for
 default-constructed objects

Reviewed-by: Friedemann Kleint
---
 share/qtcreator/gdbmacros/gdbmacros.py | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py
index 63b7c17c142..49bf406420a 100644
--- a/share/qtcreator/gdbmacros/gdbmacros.py
+++ b/share/qtcreator/gdbmacros/gdbmacros.py
@@ -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):
-- 
GitLab