X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4db97e24f5e2ad38970c55148ddb807399ecd191..bd0f3ca69710e9648fc1f1b16ddb9602f5c4800b:/samples/docview/doc.cpp diff --git a/samples/docview/doc.cpp b/samples/docview/doc.cpp index 24f3984b16..efdbf8adf7 100644 --- a/samples/docview/doc.cpp +++ b/samples/docview/doc.cpp @@ -79,6 +79,16 @@ DocumentIstream& DrawingDocument::LoadObject(DocumentIstream& istream) wxInt32 count = 0; stream >> count; + if ( count < 0 ) + { + wxLogWarning("Drawing document corrupted: invalid segments count."); +#if wxUSE_STD_IOSTREAM + istream.clear(std::ios::badbit); +#else + istream.Reset(wxSTREAM_READ_ERROR); +#endif + return istream; + } for ( int n = 0; n < count; n++ ) { @@ -186,7 +196,7 @@ bool wxTextDocument::OnCreate(const wxString& path, long flags) // when it's modified GetTextCtrl()->Connect ( - wxEVT_COMMAND_TEXT_UPDATED, + wxEVT_TEXT, wxCommandEventHandler(wxTextDocument::OnTextChange), NULL, this