From de7d35026f95a99fa36264c4291d420a7bcc5e9d Mon Sep 17 00:00:00 2001 From: crs23 Date: Mon, 10 Sep 2007 01:23:40 +0000 Subject: [PATCH] Applied patch 1547642, fixing a bug where we try to access elements in an empty std::list. --- lib/io/CStreamBuffer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/io/CStreamBuffer.cpp b/lib/io/CStreamBuffer.cpp index 2f10cac2..d11494b4 100644 --- a/lib/io/CStreamBuffer.cpp +++ b/lib/io/CStreamBuffer.cpp @@ -37,6 +37,12 @@ CStreamBuffer::peek(UInt32 n) { 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 ChunkList::iterator head = m_chunks.begin(); head->reserve(n + m_headUsed);