Skip to content

Commit

Permalink
Merge branch 'hotfix/none-deallocation-crash'
Browse files Browse the repository at this point in the history
  • Loading branch information
MinoMino committed Nov 19, 2015
2 parents 0955da0 + 91914cb commit ca6b2df
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions python_embed.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,18 @@ static PyObject* PyMinqlx_PlayerInfo(PyObject* self, PyObject* args) {
}

static PyObject* PyMinqlx_PlayersInfo(PyObject* self, PyObject* args) {
PyObject* ret = PyList_New(0);
PyObject* ret = PyList_New(sv_maxclients->integer);

for (int i = 0; i < sv_maxclients->integer; i++) {
if (svs->clients[i].state == CS_FREE) {
if (PyList_Append(ret, Py_None) == -1)
if (PyList_SetItem(ret, i, Py_None) == -1)
return NULL;
Py_INCREF(Py_None);
continue;
}

if (PyList_Append(ret, makePlayerDict(i)) == -1)
return NULL; // PyList_Append sets an error for us.
if (PyList_SetItem(ret, i, makePlayerDict(i)) == -1)
return NULL;
}

return ret;
Expand Down

0 comments on commit ca6b2df

Please sign in to comment.