- Fix crash in FileSystem::ReadFile when loading empty lumps.
This commit is contained in:
parent
b6b3c311e1
commit
ecc8701260
1 changed files with 9 additions and 6 deletions
|
|
@ -1247,13 +1247,16 @@ unsigned FileSystem::GetFilesInFolder(const char *inpath, std::vector<FolderEntr
|
|||
void FileSystem::ReadFile (int lump, void *dest)
|
||||
{
|
||||
auto lumpr = OpenFileReader (lump);
|
||||
auto size = lumpr.GetLength ();
|
||||
auto numread = lumpr.Read (dest, size);
|
||||
|
||||
if (numread != size)
|
||||
if (lumpr.mReader != nullptr)
|
||||
{
|
||||
throw FileSystemException("W_ReadFile: only read %td of %td on '%s'\n",
|
||||
numread, size, FileInfo[lump].LongName);
|
||||
auto size = lumpr.GetLength ();
|
||||
auto numread = lumpr.Read (dest, size);
|
||||
|
||||
if (numread != size)
|
||||
{
|
||||
throw FileSystemException("W_ReadFile: only read %td of %td on '%s'\n",
|
||||
numread, size, FileInfo[lump].LongName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue