X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/59af032ab6816a5cefb907a9f12c6b766a71af7c..8946ede10c2702c7acbb194fe8bd2793d7fb8358:/src/msw/ole/oleutils.cpp diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp index e23617df25..94f134a097 100644 --- a/src/msw/ole/oleutils.cpp +++ b/src/msw/ole/oleutils.cpp @@ -86,12 +86,13 @@ WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr) wxString str(bStr, len); #else wxString str; - if ( !::WideCharToMultiByte(CP_ACP, 0 /* no flags */, - bStr, len + 1 /* include last NUL */, - wxStringBuffer(str, len), len, - NULL, NULL /* no default char */) ) + if (len) { - str.clear(); + wxStringBufferLength buf(str, len); // asserts if len == 0 + buf.SetLength(WideCharToMultiByte(CP_ACP, 0 /* no flags */, + bStr, len /* not necessarily NUL-terminated */, + buf, len, + NULL, NULL /* no default char */)); } #endif