From c2c246be40c585f2d7ad2bed6abbc77fcb3d9cb1 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 21 Oct 2012 15:15:01 +0200 Subject: [PATCH] Fix bug in fallback mechanism After failure to load a piece from a specified -pieceImageDirectory the default theme was not tried, because the cairo function to load from a pgn file returns a valid handle even if the file does not exist. --- draw.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/draw.c b/draw.c index 625c0bd..84fb6a1 100644 --- a/draw.c +++ b/draw.c @@ -289,10 +289,10 @@ ScaleOnePiece (int color, int piece) if(!pngPieceImages[color][piece]) { // we don't have cached bitmap (implying we did not have cached svg) if(*appData.pieceDirectory) { // user specified piece directory snprintf(buf, MSG_SIZ, "%s/%s%s.png", appData.pieceDirectory, color ? "Black" : "White", pngPieceNames[piece]); - pngPieceImages[color][piece] = img = cairo_image_surface_create_from_png (buf); // try if there are png pieces there + img = cairo_image_surface_create_from_png (buf); // try if there are png pieces there if(cairo_surface_status(img) != CAIRO_STATUS_SUCCESS) { // there were not svgPieces[color][piece] = LoadSVG(appData.pieceDirectory, color, piece); // so try if he has svg there - } + } else pngPieceImages[color][piece] = img; } } -- 1.7.0.4