From 4ac901e4168bdda79d5aa2e770a3a8945178166e Mon Sep 17 00:00:00 2001 From: Moritz Umfahrer Date: Tue, 29 Oct 2019 11:48:36 +0100 Subject: [PATCH] Fix for division by zero error in Gradient2.cs --- Scripts/Effects/Gradient2.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/Effects/Gradient2.cs b/Scripts/Effects/Gradient2.cs index 5a2e883..f1883dc 100644 --- a/Scripts/Effects/Gradient2.cs +++ b/Scripts/Effects/Gradient2.cs @@ -125,7 +125,7 @@ namespace UnityEngine.UI.Extensions GetPosition = v => v.position.y; } - float width = 1f / w / Zoom; + float width = w == 0f ? 0f : 1f / w / Zoom; float zoomOffset = (1 - (1 / Zoom)) * 0.5f; float offset = (Offset * (1 - zoomOffset)) - zoomOffset;