From 0fd808ed32d8a4e3dd4d4b7440fbb74636f48f68 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Tue, 26 Sep 2023 11:40:40 -0400 Subject: [PATCH] omg divide by 0 --- color.d | 2 ++ 1 file changed, 2 insertions(+) diff --git a/color.d b/color.d index 0fc1359..c5d0ab5 100644 --- a/color.d +++ b/color.d @@ -720,6 +720,8 @@ void premultiplyBgra(ubyte[] bgra) pure @nogc @safe nothrow in { assert(bgra.len void unPremultiplyRgba(ubyte[] rgba) pure @nogc @safe nothrow in { assert(rgba.length == 4); } do { auto a = rgba[3]; + if(a == 0) + return; rgba[0] = cast(ubyte)(rgba[0] * 255 / a); rgba[1] = cast(ubyte)(rgba[1] * 255 / a);