From 80aed88f82f6b9415d587be0808522aae93cf12a Mon Sep 17 00:00:00 2001 From: empirephoenix Date: Wed, 24 Jul 2019 18:09:55 +0200 Subject: [PATCH] fix for NPE when being called from CombinedTexture with null baseImage (#1146) * fix for NPE when being called from CombinedTexture with null baseImage * formating only --- .../blender/textures/blending/TextureBlenderAWT.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderAWT.java b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderAWT.java index 88130fa3f..41e3e9475 100644 --- a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderAWT.java +++ b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderAWT.java @@ -142,8 +142,14 @@ public class TextureBlenderAWT extends AbstractTextureBlender { } dataArray.add(newData); } - - ColorSpace colorSpace = baseImage.getColorSpace() != null ? baseImage.getColorSpace() : ColorSpace.Linear; + + ColorSpace colorSpace; + if (baseImage != null) { + colorSpace = baseImage.getColorSpace() != null ? baseImage.getColorSpace() : ColorSpace.Linear; + } else { + colorSpace = image.getColorSpace(); + } + Image result = depth > 1 ? new Image(Format.RGBA8, width, height, depth, dataArray, colorSpace) : new Image(Format.RGBA8, width, height, dataArray.get(0), colorSpace); if (image.getMipMapSizes() != null) { result.setMipMapSizes(image.getMipMapSizes().clone());