X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8a07b43cf67138183c2a17becdc557efcbd64ddf..f53b1c1e6f5546e9916debbf5f93c652edca0ef6:/contrib/src/stc/PlatWX.cpp diff --git a/contrib/src/stc/PlatWX.cpp b/contrib/src/stc/PlatWX.cpp index d1e45d45fb..b20f68fa34 100644 --- a/contrib/src/stc/PlatWX.cpp +++ b/contrib/src/stc/PlatWX.cpp @@ -1251,7 +1251,11 @@ double ElapsedTime::Duration(bool reset) { #if wxUSE_UNICODE wxString stc2wx(const char* str, size_t len) { - if (str[len] == 0) + // 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);