From: Joonbum Ko Date: Wed, 10 Mar 2021 06:38:40 +0000 (+0900) Subject: Add NULL checking to prevent dereferenced problem. X-Git-Tag: accepted/tizen/unified/20210316.151423^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a954525ca87193e1a7c840fa71172f2310d1bea1;p=platform%2Fcore%2Fuifw%2Fvulkan-wsi-tizen.git Add NULL checking to prevent dereferenced problem. Change-Id: I6ff1a170342dd25822739dc0d4f11ff95c43e492 Signed-off-by: Joonbum Ko --- diff --git a/samples/tri.c b/samples/tri.c index b42cd55..b3986d6 100644 --- a/samples/tri.c +++ b/samples/tri.c @@ -1789,16 +1789,18 @@ static const struct wl_shell_surface_listener shell_surface_listener = { static void demo_create_window(struct demo *demo) { demo->wl_surface = wl_compositor_create_surface(demo->compositor); - demo->shell_surface = wl_shell_get_shell_surface(demo->shell, demo->wl_surface); + if (demo->wl_surface) { + demo->shell_surface = wl_shell_get_shell_surface(demo->shell, demo->wl_surface); - if (demo->shell_surface) { - wl_shell_surface_add_listener(demo->shell_surface, - &shell_surface_listener, demo); - wl_shell_surface_set_toplevel(demo->shell_surface); - wl_shell_surface_set_title(demo->shell_surface, APP_SHORT_NAME); - } + if (demo->shell_surface) { + wl_shell_surface_add_listener(demo->shell_surface, + &shell_surface_listener, demo); + wl_shell_surface_set_toplevel(demo->shell_surface); + wl_shell_surface_set_title(demo->shell_surface, APP_SHORT_NAME); + } - wl_surface_set_user_data(demo->wl_surface, demo); + wl_surface_set_user_data(demo->wl_surface, demo); + } } #endif // _WIN32