Avoid converting empty strings to NULL pointers in non-Unicode build

...when using utf8_str() or wxGTK_CONV as argument to const char* function parameter
This commit is contained in:
Paul Cornett
2019-08-25 23:08:59 -07:00
parent db16c7af93
commit 536025791a
2 changed files with 9 additions and 2 deletions

View File

@@ -1709,7 +1709,11 @@ public:
{ return FromUTF8Unchecked(utf8.c_str(), utf8.length()); }
#endif
const wxScopedCharBuffer utf8_str() const
{ return wxMBConvUTF8().cWC2MB(wc_str()); }
{
if (empty())
return wxScopedCharBuffer::CreateNonOwned("", 0);
return wxMBConvUTF8().cWC2MB(wc_str());
}
#endif
const wxScopedCharBuffer ToUTF8() const { return utf8_str(); }