Null-terminate arrays returned from wxCmdLineArgsArray
This is required for compatibility with the real argv array that this class is supposed to emulate. Closes #17531.
This commit is contained in:
@@ -51,9 +51,11 @@ public:
|
|||||||
if ( !m_argsA )
|
if ( !m_argsA )
|
||||||
{
|
{
|
||||||
const size_t count = m_args.size();
|
const size_t count = m_args.size();
|
||||||
m_argsA = new char *[count];
|
m_argsA = new char *[count + 1];
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
m_argsA[n] = wxStrdup(m_args[n].ToAscii());
|
m_argsA[n] = wxStrdup(m_args[n].ToAscii());
|
||||||
|
|
||||||
|
m_argsA[count] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_argsA;
|
return m_argsA;
|
||||||
@@ -64,9 +66,11 @@ public:
|
|||||||
if ( !m_argsW )
|
if ( !m_argsW )
|
||||||
{
|
{
|
||||||
const size_t count = m_args.size();
|
const size_t count = m_args.size();
|
||||||
m_argsW = new wchar_t *[count];
|
m_argsW = new wchar_t *[count + 1];
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
m_argsW[n] = wxStrdup(m_args[n].wc_str());
|
m_argsW[n] = wxStrdup(m_args[n].wc_str());
|
||||||
|
|
||||||
|
m_argsW[count] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_argsW;
|
return m_argsW;
|
||||||
|
Reference in New Issue
Block a user