Add an extra error check for OBJ model materials (#4402)

This commit is contained in:
Xander 2017-09-17 12:17:12 +08:00 committed by mezz
parent 9717882563
commit ce49596014
1 changed files with 8 additions and 1 deletions

View File

@ -252,7 +252,14 @@ public class OBJModel implements IModel
}
else if (key.equalsIgnoreCase("usemtl"))
{
material = this.materialLibrary.materials.get(data);
if (this.materialLibrary.materials.containsKey(data))
{
material = this.materialLibrary.materials.get(data);
}
else
{
FMLLog.log.error("OBJModel.Parser: (Model: '{}', Line: {}) material '{}' referenced but was not found", objFrom, lineNum, data);
}
usemtlCounter++;
}
else if (key.equalsIgnoreCase("v")) // Vertices: x y z [w] - w Defaults to 1.0