X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/719ee9c389634c6e51908b8a298884df520c196b..f53b1c1e6f5546e9916debbf5f93c652edca0ef6:/contrib/src/stc/PlatWX.cpp diff --git a/contrib/src/stc/PlatWX.cpp b/contrib/src/stc/PlatWX.cpp index 43b6a2a443..b20f68fa34 100644 --- a/contrib/src/stc/PlatWX.cpp +++ b/contrib/src/stc/PlatWX.cpp @@ -1251,6 +1251,14 @@ double ElapsedTime::Duration(bool reset) { #if wxUSE_UNICODE wxString stc2wx(const char* str, size_t len) { + // note: we assume that str is of length len not including the terminating null. + + if (!len) + return wxEmptyString; + else if (str[len-1] == 0) + // It's already terminated correctly. + return wxString(str, wxConvUTF8, len); + char *buffer=new char[len+1]; strncpy(buffer, str, len); buffer[len]=0;