From 4b654848c8b8e017281a3f2daa61f8c2ec2dcf25 Mon Sep 17 00:00:00 2001 From: Nicholas Barlow Date: Tue, 11 Jun 2019 15:24:55 -0700 Subject: [PATCH] Addressing regression introduced via #472. _getSpecialTexmap can dereference a null texMap if the material lacks a diffuse/specular/normal/specular map. Adding a null check in _getSpecialTexmap should fix this. --- 3ds Max/Max2Babylon/Exporter/BabylonExporter.Texture.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/3ds Max/Max2Babylon/Exporter/BabylonExporter.Texture.cs b/3ds Max/Max2Babylon/Exporter/BabylonExporter.Texture.cs index c4ee5568..bf643631 100644 --- a/3ds Max/Max2Babylon/Exporter/BabylonExporter.Texture.cs +++ b/3ds Max/Max2Babylon/Exporter/BabylonExporter.Texture.cs @@ -513,6 +513,12 @@ private BabylonTexture ExportEnvironmnentTexture(ITexmap texMap, BabylonScene ba private ITexmap _getSpecialTexmap(ITexmap texMap, out float amount) { + if (texMap == null) + { + amount = 0.0f; + return null; + } + if (texMap.ClassName == "Normal Bump") { var block = texMap.GetParamBlockByID(0); // General Block