Commit a87efd9d authored by Thomas Wouters's avatar Thomas Wouters

Coverity-found bug: don't use temp->next *before* checking it for NULL. Also

return rather than use it again.
parent c6a245ad
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment