Applied patch 1547642, fixing a bug where we try to access elements

in an empty std::list.
This commit is contained in:
crs23 2007-09-10 01:23:40 +00:00
parent b728885e25
commit de7d35026f
1 changed files with 6 additions and 0 deletions

View File

@ -37,6 +37,12 @@ CStreamBuffer::peek(UInt32 n)
{ {
assert(n <= m_size); assert(n <= m_size);
// if requesting no data then return NULL so we don't try to access
// an empty list.
if (n == 0) {
return NULL;
}
// reserve space in first chunk // reserve space in first chunk
ChunkList::iterator head = m_chunks.begin(); ChunkList::iterator head = m_chunks.begin();
head->reserve(n + m_headUsed); head->reserve(n + m_headUsed);