]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/stc/stc.cpp
Rework modal dialog code to not depend on now obsolete wxDIALOG_MODAL flag.
[wxWidgets.git] / contrib / src / stc / stc.cpp
index efedc9d76350fa24c6c61a6834d91f57748998dd..c3a5c5a725bfd36fb744765e1410e358f2decb16 100644 (file)
@@ -2549,8 +2549,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);