Skip to content

Commit

Permalink
#2673 Check if _argv is nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed Oct 15, 2024
1 parent 1d87f81 commit 278ddab
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/libcode/vx_python3_utils/wchar_argv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,11 @@ argv_len = 0;

for (j=0; j<_argc; ++j) {

len[j] = m_strlen(_argv[j]); // we're using the len array here because
// we don't want to call m_strlen more than
// once on each argv value
if (_argv != nullptr) {
len[j] = m_strlen(_argv[j]); // we're using the len array here because
// we don't want to call m_strlen more than
// once on each argv value
}

argv_len += len[j];

Expand Down Expand Up @@ -249,7 +251,7 @@ k = 0;

for (j=0; j<Argc; ++j) {

if ( mbstowcs(W_Buf + k, _argv[j], len[j]) == (size_t) -1 ) {
if ( _argv != nullptr && mbstowcs(W_Buf + k, _argv[j], len[j]) == (size_t) -1 ) {

mlog << Error << "\nWchar_Argv::set() -> "
<< "mbstowcs failed for string \"" << _argv[j] << "\"\n\n";
Expand Down

0 comments on commit 278ddab

Please sign in to comment.