git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39076
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
size_t dstLen = FromWChar(NULL, 0, inBuff, inLen);
if ( dstLen != wxCONV_FAILED )
{
size_t dstLen = FromWChar(NULL, 0, inBuff, inLen);
if ( dstLen != wxCONV_FAILED )
{
- if ( !dstLen )
- {
- // special case: can't allocate 0 size buffer below
- dstLen++;
- }
-
- wxCharBuffer buf(dstLen - 1);
+ // special case of empty input: can't allocate 0 size buffer below as
+ // wxCharBuffer insists on NUL-terminating it
+ wxCharBuffer buf(dstLen ? dstLen - 1 : 1);
if ( FromWChar(buf.data(), dstLen, inBuff, inLen) != wxCONV_FAILED )
{
if ( outLen )
if ( FromWChar(buf.data(), dstLen, inBuff, inLen) != wxCONV_FAILED )
{
if ( outLen )