[PATCH] image: segfault when the file doesn't exist

Kristian Høgsberg hoegsberg at gmail.com
Thu Aug 9 08:00:50 PDT 2012


On Mon, Aug 06, 2012 at 07:45:43PM -0700, juan.j.zhao at linux.intel.com wrote:
> From: Juan Zhao <juan.j.zhao at linux.intel.com>
> 
> don't create a window when the file doesn't exist
> to fix the bug
> https://bugs.freedesktop.org/show_bug.cgi?id=52450

Thanks, committed.  I changed the header to say "Don't segfault...".
The idea is that we want to describe the change the commit makes.  In
this case "segfault when file doesn't exist" sounds like you're changing
image.c to segfault when the file is not there :)

Kristian


> ---
>  clients/image.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/clients/image.c b/clients/image.c
> index 711f0d8..c289d76 100644
> --- a/clients/image.c
> +++ b/clients/image.c
> @@ -130,6 +130,12 @@ image_create(struct display *display, const char *filename)
>  
>  	image->filename = strdup(filename);
>  	image->image = load_cairo_surface(filename);
> +
> +	if (!image->image) {
> +		fprintf(stderr, "could not find the image %s!\n", b);
> +		return NULL;
> +	}
> +
>  	image->window = window_create(display);
>  	image->widget = frame_create(image->window, image);
>  	window_set_title(image->window, title);
> -- 
> 1.7.11
> 


More information about the wayland-devel mailing list