From: Holger Schemel Date: Sat, 12 Sep 2015 19:27:17 +0000 (+0200) Subject: fixed crash bug when using bad step offset for request dialog X-Git-Tag: 4.0.0.0-rc1~149 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=bc3ec6b70e1c180eb67be294872e58956b705245;p=rocksndiamonds.git fixed crash bug when using bad step offset for request dialog --- diff --git a/src/tools.c b/src/tools.c index 1dc080b2..b45ec0fb 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2283,7 +2283,7 @@ void DrawEnvelopeRequest(char *text) int text_width = line_length * font_width; int width = request.width; int height = request.height; - int tile_size = request.step_offset; + int tile_size = MAX(request.step_offset, 1); int x_steps = width / tile_size; int y_steps = height / tile_size; int sx_offset = border_size; @@ -2362,7 +2362,7 @@ void AnimateEnvelopeRequest(int anim_mode, int action) int anim_delay_value = (no_delay ? 0 : delay_value + 500 * 0) / 2; unsigned int anim_delay = 0; - int tile_size = request.step_offset; + int tile_size = MAX(request.step_offset, 1); int max_xsize = request.width / tile_size; int max_ysize = request.height / tile_size; int max_xsize_inner = max_xsize - 2;