[PATCH] cairo-util: load_cairo_surface returns NULL if loading the file fails.

Kristian Hoegsberg hoegsberg at gmail.com
Tue Mar 20 12:50:49 PDT 2012


On Wed, Mar 14, 2012 at 10:07:58PM +0200, ustun.ergenoglu at gmail.com wrote:
> From: Ustun Ergenoglu <ego at ustun.fi>

Thanks, applied.

Kristian

> Otherwise a non-existent file in the configuration crashes the desktop shell.
> 
> Signed-off-by: Ustun Ergenoglu <ego at ustun.fi>
> ---
>  clients/cairo-util.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/clients/cairo-util.c b/clients/cairo-util.c
> index 1f8d307..6d5794b 100644
> --- a/clients/cairo-util.c
> +++ b/clients/cairo-util.c
> @@ -300,6 +300,10 @@ load_cairo_surface(const char *filename)
>  	void *data;
>  
>  	image = load_image(filename);
> +	if (image == NULL) {
> +		return NULL;
> +	}
> +
>  	data = pixman_image_get_data(image);
>  	width = pixman_image_get_width(image);
>  	height = pixman_image_get_height(image);
> -- 
> 1.7.5.4
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list