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

This commit is contained in:
Xander authored and mezz committed 2017-09-16 21:17:12 -07:00
1 parent 9717882563
commit ce49596014
1 file changed
+8 -1
@@ -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