From 37a7d624bec4bf64d9b7e6656134a30264d29056 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 21 Dec 2019 13:14:14 -0800 Subject: [PATCH] Ensure front tile size is non-zero to avoid divide by zero exceptions. --- win/win32/mhmap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index fdd7b3a33..bff7baa86 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -305,9 +305,14 @@ mswin_map_stretch(HWND hWnd, LPSIZE map_size, BOOL redraw) } + /* TODO: Should we round instead of clamping? */ data->xFrontTile = (int) ((double) data->xBackTile * data->frontScale); data->yFrontTile = (int) ((double) data->yBackTile * data->frontScale); + /* ensure tile is at least one pixel in size */ + if (data->xFrontTile < 1) data->xFrontTile = 1; + if (data->yFrontTile < 1) data->yFrontTile = 1; + /* calcuate ASCII cursor height */ data->yBlinkCursor = (int) ((double) CURSOR_HEIGHT * data->backScale); data->yNoBlinkCursor = data->yBackTile;