1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-24 23:22:30 +01:00

wIconChangeImageFile get image block swapped

This patch swaps the if and the else blocks for the
image value. Now, if the image doesn't exist, and because
error is always "0" (is not changed after the definition),
we can exist from the wIconChangeImageFile function.

Before this patch, if the image was NULL, the error variable
was set to "1", so we must return !error, then return "0".

Because the "path" variable is not NULL, we must wfree it.

Now, the "Set the new image" block is moved out the if block.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This commit is contained in:
Rodolfo García Peñas (kix)
2013-09-28 15:33:52 +02:00
committed by Carlos R. Mafra
parent 3250144b94
commit cc01ca5c6b

View File

@@ -368,17 +368,16 @@ int wIconChangeImageFile(WIcon *icon, const char *file)
return 0;
image = get_rimage_from_file(scr, path, wPreferences.icon_size);
/* New image! */
if (!error && image) {
/* Set the new image */
set_icon_image_from_image(icon, image);
icon->file = wstrdup(path);
update_icon_pixmap(icon);
} else {
error = 1;
if (!image) {
wfree(path);
return 0;
}
/* Set the new image */
set_icon_image_from_image(icon, image);
icon->file = wstrdup(path);
update_icon_pixmap(icon);
if (path)
wfree(path);