aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/filesystem/File.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/xbmc/filesystem/File.cpp b/xbmc/filesystem/File.cpp
index c25667d320..5156284542 100644
--- a/xbmc/filesystem/File.cpp
+++ b/xbmc/filesystem/File.cpp
@@ -1034,10 +1034,15 @@ CFileStreamBuffer::int_type CFileStreamBuffer::underflow()
memmove(m_buffer, egptr()-backsize, backsize);
}
- unsigned int size = m_file->Read(m_buffer+backsize, m_frontsize);
+ ssize_t size = m_file->Read(m_buffer+backsize, m_frontsize);
- if(size == 0)
+ if (size == 0)
return traits_type::eof();
+ else if (size < 0)
+ {
+ CLog::LogF(LOGWARNING, "Error reading file - assuming eof");
+ return traits_type::eof();
+ }
setg(m_buffer, m_buffer+backsize, m_buffer+backsize+size);
return traits_type::to_int_type(*gptr());