From 7d4a713a867cc0886eb97999873d1b331e00da21 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 11 Feb 2016 14:10:49 +0100 Subject: [PATCH] Fix loading of pk3 q3bsp maps This fixes loading of pk3 maps. The pk3 files contain directory entries with a size of 0, which triggered an assertion. --- code/Q3BSPZipArchive.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Q3BSPZipArchive.cpp b/code/Q3BSPZipArchive.cpp index cc21754b3..cdc6ea2c5 100644 --- a/code/Q3BSPZipArchive.cpp +++ b/code/Q3BSPZipArchive.cpp @@ -292,7 +292,7 @@ bool Q3BSPZipArchive::mapArchive() { // The file has EXACTLY the size of uncompressed_size. In C // you need to mark the last character with '\0', so add // another character - if(unzOpenCurrentFile(m_ZipFileHandle) == UNZ_OK) { + if(fileInfo.uncompressed_size != 0 && unzOpenCurrentFile(m_ZipFileHandle) == UNZ_OK) { std::pair::iterator, bool> result = m_ArchiveMap.insert(std::make_pair(filename, new ZipFile(fileInfo.uncompressed_size))); if(unzReadCurrentFile(m_ZipFileHandle, result.first->second->m_Buffer, fileInfo.uncompressed_size) == (long int) fileInfo.uncompressed_size) {