mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-26 22:12:39 +00:00
Avoid crash when loading texture named "".
Report texture-loading errors. This was SVN commit r8006.
This commit is contained in:
@@ -50,7 +50,12 @@ LibError vfs_Lookup(const VfsPath& pathname, VfsDirectory* startDirectory, VfsDi
|
||||
|
||||
// early-out for pathname == "" when mounting into VFS root
|
||||
if(pathname.empty()) // (prevent iterator error in loop end condition)
|
||||
return INFO::OK;
|
||||
{
|
||||
if(pfile) // preserve a guarantee that if pfile then we either return an error or set *pfile
|
||||
return ERR::VFS_FILE_NOT_FOUND;
|
||||
else
|
||||
return INFO::OK;
|
||||
}
|
||||
|
||||
// for each directory component:
|
||||
VfsPath::iterator it; // (used outside of loop to get filename)
|
||||
|
||||
@@ -424,11 +424,9 @@ static LibError OglTex_reload(OglTex* ot, const PIVFS& vfs, const VfsPath& pathn
|
||||
if(!(ot->flags & OT_TEX_VALID))
|
||||
{
|
||||
shared_ptr<u8> file; size_t fileSize;
|
||||
if(vfs->LoadFile(pathname, file, fileSize) >= 0)
|
||||
{
|
||||
if(tex_decode(file, fileSize, &ot->t) >= 0)
|
||||
ot->flags |= OT_TEX_VALID;
|
||||
}
|
||||
RETURN_ERR(vfs->LoadFile(pathname, file, fileSize));
|
||||
if(tex_decode(file, fileSize, &ot->t) >= 0)
|
||||
ot->flags |= OT_TEX_VALID;
|
||||
}
|
||||
|
||||
glGenTextures(1, &ot->id);
|
||||
|
||||
Reference in New Issue
Block a user