diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0e8cea36d3e..d1964c1208a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2010-07-09 Tom Tromey + + * python/py-prettyprint.c (gdbpy_get_display_hint): Don't use + 'hint' if it is NULL. + 2010-07-09 Hui Zhu * source.c (print_source_lines_base): Add check for noprint. diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index 9a205b4ab7f..434c8a593da 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -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 ();