X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/217f9d07673020ad2f995f269552dad27950a6e4..2645b45a757dfd92214e8a395398982f4d1bb9fd:/src/common/cmdline.cpp diff --git a/src/common/cmdline.cpp b/src/common/cmdline.cpp index 5ac040b271..fd6c8f6c54 100644 --- a/src/common/cmdline.cpp +++ b/src/common/cmdline.cpp @@ -460,6 +460,8 @@ size_t wxCmdLineParser::GetParamCount() const wxString wxCmdLineParser::GetParam(size_t n) const { + wxCHECK_MSG( n < GetParamCount(), wxEmptyString, _T("invalid param index") ); + return m_data->m_parameters[n]; } @@ -988,7 +990,7 @@ static wxString GetTypeName(wxCmdLineParamType type) /* This function is mainly used under Windows (as under Unix we always get the - command line arguments as agrc/argv anyhow) and so it tries to handle the + command line arguments as argc/argv anyhow) and so it tries to handle the Windows path names (separated by backslashes) correctly. For this it only considers that a backslash may be used to escape another backslash (but normally this is _not_ needed) or a quote but nothing else. @@ -1038,7 +1040,8 @@ wxArrayString wxCmdLineParser::ConvertStringToArgs(const wxChar *p) p++; // if we have 2 backslashes in a row, output one - if ( isQuotedByBS ) + // unless it looks like a UNC path \\machine\dir\file.ext + if ( isQuotedByBS || arg.Len() == 0 ) { arg += _T('\\'); isQuotedByBS = FALSE;