* python/py-prettyprint.c (gdbpy_get_display_hint): Don't use
authorTom Tromey <tromey@redhat.com>
Fri, 9 Jul 2010 20:29:56 +0000 (20:29 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 9 Jul 2010 20:29:56 +0000 (20:29 +0000)
'hint' if it is NULL.

gdb/ChangeLog
gdb/python/py-prettyprint.c

index 0e8cea36d3e9ff41885b25f8a628878a98e1c69c..d1964c1208a0474ef2c6c34c496108094da3b2d7 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-09  Tom Tromey  <tromey@redhat.com>
+
+       * python/py-prettyprint.c (gdbpy_get_display_hint): Don't use
+       'hint' if it is NULL.
+
 2010-07-09  Hui Zhu  <teawater@gmail.com>
 
        * source.c (print_source_lines_base): Add check for noprint.
index 9a205b4ab7fb080d1e4e7401e13638c08cc04160..434c8a593da3aa703453d9b936caaf41b6b5faa2 100644 (file)
@@ -229,10 +229,12 @@ gdbpy_get_display_hint (PyObject *printer)
     return NULL;
 
   hint = PyObject_CallMethodObjArgs (printer, gdbpy_display_hint_cst, NULL);
-  if (gdbpy_is_string (hint))
-    result = python_string_to_host_string (hint);
   if (hint)
-    Py_DECREF (hint);
+    {
+      if (gdbpy_is_string (hint))
+       result = python_string_to_host_string (hint);
+      Py_DECREF (hint);
+    }
   else
     gdbpy_print_stack ();