Kaydet (Commit) 47f003d3 authored tarafından 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.
üst 622927b8
...@@ -111,10 +111,12 @@ remove_lop(PyCursesPanelObject *po) ...@@ -111,10 +111,12 @@ remove_lop(PyCursesPanelObject *po)
free(temp); free(temp);
return; return;
} }
while (temp->next->po != po) { while (temp->next == NULL || temp->next->po != po) {
if (temp->next == NULL) if (temp->next == NULL) {
PyErr_SetString(PyExc_RuntimeError, PyErr_SetString(PyExc_RuntimeError,
"remove_lop: can't find Panel Object"); "remove_lop: can't find Panel Object");
return;
}
temp = temp->next; temp = temp->next;
} }
n = temp->next->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