From e2244f44b1b911521716288e3c1e37d092e453ae Mon Sep 17 00:00:00 2001 From: Dorian Wouters Date: Thu, 17 Dec 2015 18:45:15 +0100 Subject: [PATCH] Fix [amc] division by 0 --- mods/automappercolors/process.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mods/automappercolors/process.py b/mods/automappercolors/process.py index 60852b0f..e2183826 100755 --- a/mods/automappercolors/process.py +++ b/mods/automappercolors/process.py @@ -26,7 +26,8 @@ predefined = { "^flowers:geranium": {'r': 75, 'g': 101, 'b': 84}, "^flowers:rose": {'r': 153, 'g': 9, 'b': 0}, "^flowers:tulip": {'r': 175, 'g': 114, 'b': 0}, - "^flowers:viola": {'r': 84, 'g': 90, 'b': 64} + "^flowers:viola": {'r': 84, 'g': 90, 'b': 64}, + "^glass_arena:wall": {'r': 255, 'g': 0, 'b': 0} } predef_compiled = {} @@ -89,9 +90,10 @@ else: ccumul[1] += (pxl[1]*pxl[3])/255 ccumul[2] += (pxl[2]*pxl[3])/255 ccumul[3] += pxl[3] - if ccumul[3] > 0: + a = ccumul[3]/255 + if a > 0: for i in range(3): - ccumul[i] /= ccumul[3]/255 + ccumul[i] /= a if r_override is not None: ccumul[0] = r_override if g_override is not None: