Fix bug #45775 (Infinite loop on nonexistent texture file)
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sat, 27 Feb 2016 19:45:01 +0000 (20:45 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sat, 27 Feb 2016 19:45:01 +0000 (20:45 +0100)
draw.c

diff --git a/draw.c b/draw.c
index afb6393..01add14 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -253,7 +253,7 @@ CreatePNGBoard (char *s, int kind)
     textureW[kind] = 0; // prevents bitmap from being used if not succesfully loaded
     if(strstr(s, ".png")) {
        cairo_surface_t *img = cairo_image_surface_create_from_png (s);
-       if(img) {
+       if(cairo_surface_status(img) == CAIRO_STATUS_SUCCESS) {
            char c, *p = s, *q;
            int r, f;
            if(pngOriginalBoardBitmap[kind]) cairo_surface_destroy(pngOriginalBoardBitmap[kind]);