From 7ba4c1cc9bfb590100f9bd4ab607186555565f59 Mon Sep 17 00:00:00 2001 From: "Johannes M. Griebler" Date: Sun, 16 Oct 2016 22:29:10 +0200 Subject: [PATCH] Fix two segfaults trying to display invalid icons --- x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x.c b/x.c index 01aa62e..d6975bf 100644 --- a/x.c +++ b/x.c @@ -306,7 +306,7 @@ static cairo_surface_t *gdk_pixbuf_to_cairo_surface(const GdkPixbuf *pixbuf) static GdkPixbuf *get_pixbuf_from_file(const char *icon_path) { - GdkPixbuf *pixbuf; + GdkPixbuf *pixbuf = NULL; if (is_readable_file(icon_path)) { GError *error = NULL; pixbuf = gdk_pixbuf_new_from_file(icon_path, &error); @@ -427,7 +427,7 @@ static colored_layout *r_init_shared(cairo_t *c, notification *n) cl->icon = NULL; } - if (cairo_surface_status(cl->icon) != CAIRO_STATUS_SUCCESS) { + if (cl->icon && cairo_surface_status(cl->icon) != CAIRO_STATUS_SUCCESS) { cairo_surface_destroy(cl->icon); cl->icon = NULL; }