]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/mstream.cpp
As small as possible reorganization within wxDateTime to please PCH in DLL build...
[wxWidgets.git] / src / common / mstream.cpp
index 5c4302a6407118f019b247056bd26af90c2a45cd..21cc9ee95c56ced529ec7f56a096ac453934afa7 100644 (file)
@@ -60,8 +60,15 @@ wxMemoryInputStream::~wxMemoryInputStream()
 char wxMemoryInputStream::Peek()
 {
     char *buf = (char *)m_i_streambuf->GetBufferStart();
+    size_t pos = m_i_streambuf->GetIntPosition();
+    if ( pos == m_length )
+    {
+        m_lasterror = wxSTREAM_READ_ERROR;
+
+        return 0;
+    }
 
-    return buf[m_i_streambuf->GetIntPosition()];
+    return buf[pos];
 }
 
 bool wxMemoryInputStream::Eof() const