]> git.saurik.com Git - wxWidgets.git/blobdiff - src/stc/stc.cpp.in
set device origin when drawing on a frame in order to not overwrite the menu/toolbar...
[wxWidgets.git] / src / stc / stc.cpp.in
index 473e08d38ef3552af69848f652e2cc4fbc918b7c..a859ec1a47e8a2a97f2987770cc25193c92e7a73 100644 (file)
@@ -358,8 +358,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);