From 8c6525a2b7870e1bc0bcbddf11c11e09054f389e Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Mon, 19 May 2014 19:51:28 +0200 Subject: [PATCH] WPrefs: changed renderTexture to always fallback to solid black when image can't be loaded As raised by Carlos R. Mafra and Doug Torrance, when an image is used in a texture but the image cannot be loaded, there are some case where WPrefs misbehaves. This patch display a warning in every case where the image could not be loaded, and always switch to black texture as a fallback, which was not the case previously. Signed-off-by: Christophe CURIS --- WPrefs.app/Appearance.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c index 9b42034f..dc1d8c02 100644 --- a/WPrefs.app/Appearance.c +++ b/WPrefs.app/Appearance.c @@ -512,12 +512,16 @@ static Pixmap renderTexture(WMScreen * scr, WMPropList * texture, int width, int path = wfindfileinarray(GetObjectForKey("PixmapPath"), str); if (path) { timage = RLoadImage(rc, path, 0); - if (!timage) { - wwarning("could not load file '%s': %s", path ? path : str, RMessageForError(RErrorCode)); - texture = WMCreatePropListFromDescription("(solid, black)"); - type = "solid"; - } + if (!timage) + wwarning("could not load file '%s': %s", path, RMessageForError(RErrorCode)); wfree(path); + } else { + wwarning("could not find file '%s' for %s of texture", str, type); + timage = NULL; + } + if (!timage) { + texture = WMCreatePropListFromDescription("(solid, black)"); + type = "solid"; } }