Fix two segfaults trying to display invalid icons
This commit is contained in:
parent
57d3b293a2
commit
7ba4c1cc9b
4
x.c
4
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)
|
static GdkPixbuf *get_pixbuf_from_file(const char *icon_path)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf = NULL;
|
||||||
if (is_readable_file(icon_path)) {
|
if (is_readable_file(icon_path)) {
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
pixbuf = gdk_pixbuf_new_from_file(icon_path, &error);
|
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;
|
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);
|
cairo_surface_destroy(cl->icon);
|
||||||
cl->icon = NULL;
|
cl->icon = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user