Check for end of buffer in wxMemoryInputStream::Peek.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31242 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon 2005-01-05 07:36:14 +00:00
parent da6e77b8d6
commit 6c783b03a0

View 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 buf[m_i_streambuf->GetIntPosition()];
return 0;
}
return buf[pos];
}
bool wxMemoryInputStream::Eof() const