diff options
author | Tom Tromey <tromey@redhat.com> | 2010-10-12 22:44:20 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2010-10-12 22:44:20 +0000 |
commit | 1bdb0c5472c10b1af38b915df48ceee417192aa3 (patch) | |
tree | 00ea9be44f983ff25858e1fc057ddad38b15a297 /gdb/python | |
parent | 0526b37ab5b8f8ba89f8ea4d4d86522fc4bd807c (diff) | |
download | gdb-1bdb0c5472c10b1af38b915df48ceee417192aa3.zip gdb-1bdb0c5472c10b1af38b915df48ceee417192aa3.tar.gz gdb-1bdb0c5472c10b1af38b915df48ceee417192aa3.tar.bz2 |
* python/py-prettyprint.c (search_pp_list): Fix error checking.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-prettyprint.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index 434c8a5..7aa83bc 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -49,9 +49,20 @@ search_pp_list (PyObject *list, PyObject *value) return NULL; /* Skip if disabled. */ - if (PyObject_HasAttr (function, gdbpy_enabled_cst) - && ! PyObject_IsTrue (PyObject_GetAttr (function, gdbpy_enabled_cst))) - continue; + if (PyObject_HasAttr (function, gdbpy_enabled_cst)) + { + PyObject *attr = PyObject_GetAttr (function, gdbpy_enabled_cst); + int cmp; + + if (!attr) + return NULL; + cmp = PyObject_IsTrue (attr); + if (cmp == -1) + return NULL; + + if (!cmp) + continue; + } printer = PyObject_CallFunctionObjArgs (function, value, NULL); if (! printer) |