Handle more gracefully the case where a texture

directive has no image specified.  Prior to this
it was throwing an ArrayIndexOutOfBounds exception
which was silently swallowed even though the
import fails.
This commit is contained in:
Paul Speed 2014-12-20 03:49:53 -05:00
parent d399e0594b
commit 9eca2251a9

View File

@ -159,6 +159,11 @@ public class MaterialLoader implements AssetLoader {
String[] split = statement.getLine().split(" ", 2);
String keyword = split[0];
if (keyword.equals("texture")){
if (split.length < 2) {
logger.log(Level.WARNING, "Invalid texture directive, no image specified at [{0}]",
statement.getLineNumber());
return;
}
readTextureImage(split[1]);
}else if (keyword.equals("tex_address_mode")){
String mode = split[1];