From 8c16b35bafd9a51060095bff4a62fc327c4cf495 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 1 Mar 2022 18:18:07 +0100 Subject: [PATCH] fixed crash bug for some graphics configurations with global border This crash may happen if parts of a global screen border graphic are configured to be drawn (like "border.draw_masked.DOOR: true") while the global screen border graphic itself is configured to be undefined (like "global.border.MAIN: [NONE]"), which causes an attempt to blit from a bitmap that is NULL, resulting in a segmentation fault. This commit adds a check to prevent this. --- src/tools.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools.c b/src/tools.c index 144bce2a..c8070fa2 100644 --- a/src/tools.c +++ b/src/tools.c @@ -512,6 +512,10 @@ static void DrawMaskedBorderExt_Rect(int x, int y, int width, int height, Bitmap *src_bitmap = getGlobalBorderBitmapFromStatus(global.border_status); Bitmap *dst_bitmap = gfx.masked_border_bitmap_ptr; + // may happen for "border.draw_masked.*" with undefined "global.border.*" + if (src_bitmap == NULL) + return; + if (x == -1 && y == -1) return; -- 2.34.1