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
This commit is contained in:
Juan Zhao 2012-08-06 19:45:43 -07:00 committed by Kristian Høgsberg
parent 8801357332
commit 19a4c2db26
1 changed files with 6 additions and 0 deletions

View File

@ -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);