SL-17967 - do not crash on zero-sized materials

meow-7.2.2
Howard Stearns 2022-09-02 16:01:38 -07:00
parent 013a713001
commit cf8e1b2ac4
1 changed files with 8 additions and 1 deletions

View File

@ -56,9 +56,16 @@ LLGLTFMaterial* LLGLTFMaterialList::getMaterial(const LLUUID& id)
}
LLFileSystem file(id, asset_type, LLFileSystem::READ);
auto size = file.getSize();
if (!size)
{
LL_DEBUGS() << "Zero size material." << LL_ENDL;
mat->unref();
return;
}
std::vector<char> buffer;
buffer.resize(file.getSize());
buffer.resize(size);
file.read((U8*)&buffer[0], buffer.size());
LLSD asset;