Corrected a couple problems in wxStreamBuffer that show up when

reading from a wxMemoryStream


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17977 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-11-27 02:00:23 +00:00
parent fddf5d878a
commit d5c363173a

View File

@@ -58,7 +58,7 @@
void wxStreamBuffer::SetError(wxStreamError err) void wxStreamBuffer::SetError(wxStreamError err)
{ {
if ( m_stream->m_lasterror == wxSTREAM_NO_ERROR ) if ( m_stream && m_stream->m_lasterror == wxSTREAM_NO_ERROR )
m_stream->m_lasterror = err; m_stream->m_lasterror = err;
} }
@@ -198,7 +198,9 @@ bool wxStreamBuffer::FillBuffer()
{ {
wxInputStream *inStream = GetInputStream(); wxInputStream *inStream = GetInputStream();
wxCHECK_MSG( inStream, FALSE, _T("should have a stream in wxStreamBuffer") ); // It's legal to have no stream, so we shouldn't don't about it just return FALSE
if ( !inStream )
return FALSE;
size_t count = inStream->OnSysRead(m_buffer_start, m_buffer_size); size_t count = inStream->OnSysRead(m_buffer_start, m_buffer_size);
if ( !count ) if ( !count )