Avoid dereferencing a null pointer in the 'LoadMaterials' function in the models module (#1498)

This commit is contained in:
Victor Gallet 2020-12-31 13:28:53 +01:00 committed by GitHub
parent 9fe153ae29
commit 03278a74bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

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;