Avoid crash when loading texture named "".

Report texture-loading errors.

This was SVN commit r8006.
This commit is contained in:
Ykkrosh
2010-08-19 21:58:27 +00:00
parent 90207a5018
commit 9fa5af5fbf
2 changed files with 9 additions and 6 deletions
+6 -1
View File
@@ -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)
+3 -5
View File
@@ -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);