diff --git a/MOD.Scripts.Core.Scene/MODSceneController.cs b/MOD.Scripts.Core.Scene/MODSceneController.cs index 1fdd9828..337b76c9 100644 --- a/MOD.Scripts.Core.Scene/MODSceneController.cs +++ b/MOD.Scripts.Core.Scene/MODSceneController.cs @@ -193,6 +193,14 @@ public static bool TryGetLayerFilter(int layer, out Filter value) public static void ApplyFilters(int layer, Texture2D texture) { + // This avoids a crash when "GetPixels32 called on a degenerate image (dimensions 0x0)" + // "UnityException: Texture '' is not configured correctly to allow GetPixels" + if (texture.width == 0 || texture.height == 0) + { + Debug.LogError("WARNING: ApplyFilters() called on texture with zero width and zero height. No filters will be applied."); + return; + } + if (!TryGetLayerFilter(layer, out Filter value)) { return; } var watch = System.Diagnostics.Stopwatch.StartNew(); var pixels = texture.GetPixels32();