Ensure front tile size is non-zero to avoid divide by zero exceptions.

This commit is contained in:
Bart House
2019-12-21 13:14:14 -08:00
parent fb044c1a9f
commit 37a7d624be

View File

@@ -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;