summaryrefslogtreecommitdiffstats
path: root/Modules/_curses_panel.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_curses_panel.c')
-rw-r--r--Modules/_curses_panel.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index c3f313a..0acf3fd 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -111,10 +111,12 @@ remove_lop(PyCursesPanelObject *po)
free(temp);
return;
}
- while (temp->next->po != po) {
- if (temp->next == NULL)
+ while (temp->next == NULL || temp->next->po != po) {
+ if (temp->next == NULL) {
PyErr_SetString(PyExc_RuntimeError,
"remove_lop: can't find Panel Object");
+ return;
+ }
temp = temp->next;
}
n = temp->next->next;