From 1b761604103c51114edef87345e945165745c165 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Wed, 13 Sep 2017 18:53:50 +0200 Subject: [PATCH] Blender Importer: Don't crash when a packed texture couldn't be loaded --- .../scene/plugins/blender/textures/TextureHelper.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/TextureHelper.java b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/TextureHelper.java index 8bd1a2503..3e5e0bf1c 100644 --- a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/TextureHelper.java +++ b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/TextureHelper.java @@ -251,7 +251,13 @@ public class TextureHelper extends AbstractBlenderHelper { blenderContext.getInputStream().setPosition(dataFileBlock.getBlockPosition()); // Should the texture be flipped? It works for sinbad .. - result = new Texture2D(new ImageLoader().loadImage(blenderContext.getInputStream(), dataFileBlock.getBlockPosition(), true)); + Image img = new ImageLoader().loadImage(blenderContext.getInputStream(), dataFileBlock.getBlockPosition(), true); + + if (img != null) { + result = new Texture2D(img); + } else { + LOGGER.fine("ImageLoader returned null. It probably failed to load the packed texture"); + } } } //} else {