X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1c26fbe00e29543f772f31afbb8017c40bb5fd95..f53b1c1e6f5546e9916debbf5f93c652edca0ef6:/contrib/src/stc/stc.cpp diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index efedc9d763..f96e8ffadc 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////// // Name: stc.cpp -// Purpose: A wxWindows implementation of Scintilla. This class is the +// Purpose: A wxWidgets implementation of Scintilla. This class is the // one meant to be used directly by wx applications. It does not // derive directly from the Scintilla classes, but instead // delegates most things to the real Scintilla class. @@ -76,7 +76,6 @@ DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED ) DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD ) DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK ) DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN ) -DEFINE_EVENT_TYPE( wxEVT_STC_POSCHANGED ) DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED ) DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION ) DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED ) @@ -2549,8 +2548,10 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename) #if wxUSE_UNICODE wxMemoryBuffer buffer(len+1); success = (file.Read(buffer.GetData(), len) == len); - ((char*)buffer.GetData())[len] = 0; - contents = wxString(buffer, *wxConvCurrent); + if (success) { + ((char*)buffer.GetData())[len] = 0; + contents = wxString(buffer, *wxConvCurrent, len); + } #else wxString buffer; success = (file.Read(wxStringBuffer(buffer, len), len) == len);