From: H.G.Muller Date: Fri, 9 Feb 2018 16:11:27 +0000 (+0100) Subject: Fix crash by using texture in black square X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=e1b40d86901fa0cce2568df412f657ad6bcbd1c2;p=xboard.git Fix crash by using texture in black square When BlankSquare was called with square_color = 2 to black out a square (as when drawing holdings), it tried to use a non-existent texture bitmap for this when background textures were on, risking a segfault in Cairo. --- diff --git a/draw.c b/draw.c index 79518a0..5190d56 100644 --- a/draw.c +++ b/draw.c @@ -774,7 +774,7 @@ DrawLogo (Option *opt, void *logo) static void BlankSquare (cairo_surface_t *dest, int x, int y, int color, ChessSquare piece, int fac) { // [HGM] extra param 'fac' for forcing destination to (0,0) for copying to animation buffer - int x0, y0, texture = (useTexture & color+1) && CutOutSquare(x, y, &x0, &y0, color); + int x0, y0, texture = color < 2 && (useTexture & color+1) && CutOutSquare(x, y, &x0, &y0, color); cairo_t *cr; cr = cairo_create (dest);