X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8a07b43cf67138183c2a17becdc557efcbd64ddf..3e2656801d825761f55ea9b0b766802c6cd32f1d:/src/stc/PlatWX.cpp diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index d1e45d45fb..b20f68fa34 100644 --- a/src/stc/PlatWX.cpp +++ b/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);