From 8634f51b637ca4f8511ce3cba91f36e2927ed614 Mon Sep 17 00:00:00 2001 From: Juan Zhao Date: Wed, 20 Jun 2012 19:29:27 -0700 Subject: [PATCH] tablet-shell client:fix one seg-fault error When the icon provided in weston.ini is not available, it will report a segfault error. Check the icon at first. backtrace: *INT_cairo_surface_status (surface=0x0) at cairo-surface.c:259 259 { (gdb) bt #0 *INT_cairo_surface_status (surface=0x0) at cairo-surface.c:259 #1 0x0804baca in tablet_shell_add_launcher (data=0xbfb800ec) at tablet-shell.c:404 #2 launcher_section_done (data=0xbfb800ec) at tablet-shell.c:434 #3 0x08051121 in parse_config_file ( path=0x8b96c10 "/root/.config/weston.ini", sections=0x8053c80, num_sections=2, data=0xbfb800ec) at config-parser.c:113 #4 0x0804c0f9 in main (argc=1, argv=0xbfb801d4) at tablet-shell.c:480 Signed-off-by: Juan Zhao --- clients/tablet-shell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c index 0f58d5c..5a2bd34 100644 --- a/clients/tablet-shell.c +++ b/clients/tablet-shell.c @@ -401,7 +401,8 @@ tablet_shell_add_launcher(struct tablet *tablet, launcher = malloc(sizeof *launcher); launcher->path = strdup(path); launcher->icon = load_cairo_surface(icon); - if (cairo_surface_status (launcher->icon) != CAIRO_STATUS_SUCCESS) { + if ( !launcher->icon || + cairo_surface_status (launcher->icon) != CAIRO_STATUS_SUCCESS) { fprintf(stderr, "couldn't load %s\n", icon); free(launcher); return; -- 2.7.4