summaryrefslogtreecommitdiff
path: root/libmate-desktop/mate-bg.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-01-10 14:03:07 +0100
committerRobert Antoni Buj Gelonch <[email protected]>2021-02-08 22:34:03 +0100
commit44193bc230d11676c8a2ae247f819deaaebb82c0 (patch)
treebb9275c76f93357954790870e8765bc0d29945fb /libmate-desktop/mate-bg.c
parentb3be7952074144fe4077ab12780b5bacb853729a (diff)
downloadmate-desktop-44193bc230d11676c8a2ae247f819deaaebb82c0.tar.bz2
mate-desktop-44193bc230d11676c8a2ae247f819deaaebb82c0.tar.xz
g_settings_get_string always returns a newly-allocated string
Diffstat (limited to 'libmate-desktop/mate-bg.c')
-rw-r--r--libmate-desktop/mate-bg.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index 2bc7f66..647d38f 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -195,15 +195,10 @@ static FileSize *find_best_size (GSList *sizes,
static void
color_from_string (const char *string,
- GdkRGBA *colorp)
+ GdkRGBA *colorp)
{
- /* If all else fails use black */
- gdk_rgba_parse (colorp, "#000000");
-
- if (!string)
- return;
-
- gdk_rgba_parse (colorp, string);
+ if (!string || *string == '\0' || !gdk_rgba_parse (colorp, string))
+ gdk_rgba_parse (colorp, "#000000"); /* If all else fails use black */
}
static char *
@@ -403,8 +398,7 @@ mate_bg_load_from_gsettings (MateBG *bg,
mate_bg_set_placement (bg, placement);
mate_bg_set_filename (bg, filename);
- if (filename != NULL)
- g_free (filename);
+ g_free (filename);
}
void