From eabf6032a24a63a2341a2ca054300600e24c2868 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Thu, 21 Jan 2021 10:22:10 -0500 Subject: [PATCH] fix from ketmar --- png.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/png.d b/png.d index 909d89d..f42a127 100644 --- a/png.d +++ b/png.d @@ -1913,7 +1913,7 @@ immutable(ubyte)[] unfilter(ubyte filterType, in ubyte[] data, in ubyte[] previo foreach(i; 0 .. arr.length) { auto prev = i < bpp ? 0 : arr[i - bpp]; arr[i] += cast(ubyte) - /*std.math.floor*/( cast(int) (prev + previousLine[i]) / 2); + /*std.math.floor*/( cast(int) (prev + (previousLine.length ? previousLine[i] : 0)) / 2); } return assumeUnique(arr);