From d103172ee9fde65cf2e6593363bc0cbebeeba710 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Tue, 19 Jan 2021 00:14:44 -0800 Subject: [PATCH] Abort if window + button size is a bad combo Abort if the requested combination of window size and button size would result in no buttons being visible in the UI. --- src/tuxpaint.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 66e5e4669..a9528dc1a 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -801,6 +801,11 @@ static void setup_normal_screen_layout(void) /* need 56 minimum for the Tux area */ buttons_tall = (WINDOW_HEIGHT - r_ttoolopt.h - 56 * button_scale - r_colors.h) / button_h; + if (buttons_tall < 2) { + fprintf(stderr, "Button size '%d' with window size '%dx%d' is not reasonable.\n", button_w, WINDOW_WIDTH, WINDOW_HEIGHT); + exit(93); + } + gd_tools.rows = buttons_tall; gd_toolopt.rows = buttons_tall;