summaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-tui.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c
index ca88f85eb9f..95c71f1d2dd 100644
--- a/gdb/python/py-tui.c
+++ b/gdb/python/py-tui.c
@@ -133,7 +133,10 @@ tui_py_window::~tui_py_window ()
{
gdbpy_enter enter_py (get_current_arch (), current_language);
- if (PyObject_HasAttrString (m_window.get (), "close"))
+ /* This can be null if the user-provided Python construction
+ function failed. */
+ if (m_window != nullptr
+ && PyObject_HasAttrString (m_window.get (), "close"))
{
gdbpy_ref<> result (PyObject_CallMethod (m_window.get (), "close",
nullptr));