diff options
author | Juan Zhao <juan.j.zhao@linux.intel.com> | 2012-08-06 19:45:43 -0700 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-08-09 10:55:40 -0400 |
commit | 19a4c2db26c0090ec942304e7dbf605c04c43841 (patch) | |
tree | f8cd58556b5d454fefdc27fea23b90b50c30740e /clients/image.c | |
parent | 8801357332b7a239e0d1b84cae87334d3fbd80db (diff) | |
download | weston-19a4c2db26c0090ec942304e7dbf605c04c43841.tar.gz |
image: Don't segfault when the file doesn't exist
Don't create a window when the file doesn't exist.
https://bugs.freedesktop.org/show_bug.cgi?id=52450
Diffstat (limited to 'clients/image.c')
-rw-r--r-- | clients/image.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clients/image.c b/clients/image.c index 711f0d8c..c289d76c 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); |