mirror of https://github.com/python/cpython
Coverity-found bug: don't use temp->next *before* checking it for NULL. Also
return rather than use it again.
This commit is contained in:
parent
622927b850
commit
47f003d326
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue