Avoid dereferencing a null pointer in the 'LoadMaterials' function in the models module

This commit is contained in:
Elkantor 2020-12-31 10:55:46 +01:00
parent 2f966531a7
commit 62ce7dc2dc

View File

@ -948,7 +948,10 @@ Material *LoadMaterials(const char *fileName, int *materialCount)
#endif
// Set materials shader to default (DIFFUSE, SPECULAR, NORMAL)
for (unsigned int i = 0; i < count; i++) materials[i].shader = GetShaderDefault();
if (materials != NULL)
{
for (unsigned int i = 0; i < count; i++) materials[i].shader = GetShaderDefault();
}
*materialCount = count;
return materials;