]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/docview/doc.cpp
Resolve ambiguity between GetClientXXX() methods in wxOSX wxComboBox.
[wxWidgets.git] / samples / docview / doc.cpp
index 24f3984b165033c74cc83840cbe4ea1c921c47f7..e093d82ae3c578ec913eb3657fe025ba20498099 100644 (file)
@@ -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++ )
     {