Skip to content

Commit

Permalink
fixed: "|s" passed to PyArg_ParseTuple means the string is an optiona…
Browse files Browse the repository at this point in the history
…l parameter, so if it's not there the char** is not modified, we need to initialize it to NULL and check if it's set later on
  • Loading branch information
bobo1on1 committed Jun 6, 2012
1 parent 9b7ac43 commit 1a2e1bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xbmc/interfaces/python/xbmcmodule/xbmcvfsmodule.cpp
Expand Up @@ -64,7 +64,7 @@ extern "C" {
PyObject* File_New(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *f_line;
char *cLine;
char *cLine = NULL;
if (!PyArg_ParseTuple(
args,
(char*)"O|s",
Expand All @@ -82,7 +82,7 @@ extern "C" {
return NULL;

self->pFile = new CFile();
if (strncmp(cLine, "w", 1) == 0)
if (cLine && strncmp(cLine, "w", 1) == 0)
{
CPyThreadState pyState;
self->pFile->OpenForWrite(strSource,true);
Expand Down

0 comments on commit 1a2e1bd

Please sign in to comment.