From cb8ae0b5602a980c95ed8055c68bea5b61db3298 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 13 Jul 2021 00:15:29 -0400 Subject: [PATCH] - fix /0 error caused by having a completely black font character. this error was triggered by Return of the Triad. --- src/common/fonts/v_font.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/fonts/v_font.cpp b/src/common/fonts/v_font.cpp index 6b002b754..d353887c6 100644 --- a/src/common/fonts/v_font.cpp +++ b/src/common/fonts/v_font.cpp @@ -673,6 +673,10 @@ void V_ApplyLuminosityTranslation(int translation, uint8_t* pixel, int size) int lum_range = (lum_max - lum_min + 1); PalEntry* remap = paletteptr + colorrange * 256; + // why was this ever allowed to divide by zero? + if (!lum_max) + lum_max++; + for (int i = 0; i < size; i++, pixel += 4) { // we must also process the transparent pixels here to ensure proper filtering on the characters' edges.