sample-client: fix implicit NULL reference defects 53/148253/1
authorSung-Jin Park <sj76.park@samsung.com>
Thu, 7 Sep 2017 07:57:04 +0000 (16:57 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 7 Sep 2017 07:57:04 +0000 (16:57 +0900)
Change-Id: Ic7e9dc028e09da2c3fa730a2f783ef8039f584be
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
src/samples/sample-client.c

index d413a4a8cb21467c0e5d8b75012d238a902018bf..ecf4ff28ce0ddf09089c6a2b5ef99bad79c5ed2a 100644 (file)
@@ -594,34 +594,41 @@ global_registry_add(void * data, struct wl_registry * registry, uint32_t id, con
                client->shell = wl_registry_bind(client->registry, id, &xdg_shell_interface, 1);
 
                if (client->shell)
+               {
                        TRACE("[PID:%d] Succeed to bind xdg_shell interface !\n", client->pid);
 
-               xdg_shell_use_unstable_version(client->shell, 5);
-               xdg_shell_add_listener(client->shell, &xdg_shell_listener, client->display);
+                       xdg_shell_use_unstable_version(client->shell, 5);
+                       xdg_shell_add_listener(client->shell, &xdg_shell_listener, client->display);
+               }
        }
        else if (0 == strncmp(interface, "wl_shm", 6))
        {
                client->shm = wl_registry_bind(client->registry, id, &wl_shm_interface, 1);
-               wl_shm_add_listener(client->shm, &shm_listener, NULL);
 
                if (client->shm)
+               {
                        TRACE("[PID:%d] Succeed to bind wl_shm_interface !\n", client->pid);
+
+                       wl_shm_add_listener(client->shm, &shm_listener, NULL);
+               }
        }
        else if (0 == strncmp(interface, "wl_seat", 7))
        {
                client->seat = wl_registry_bind(client->registry, id, &wl_seat_interface, 1);
 
                if (client->seat)
+               {
                        TRACE("[PID:%d] Succeed to bind wl_seat_interface !\n", client->pid);
 
-               client->pointer = wl_seat_get_pointer(client->seat);
-               wl_pointer_add_listener(client->pointer, &pointer_listener, client);
+                       client->pointer = wl_seat_get_pointer(client->seat);
+                       wl_pointer_add_listener(client->pointer, &pointer_listener, client);
 
-               client->keyboard = wl_seat_get_keyboard(client->seat);
-               wl_keyboard_add_listener(client->keyboard, &keyboard_listener, client);
+                       client->keyboard = wl_seat_get_keyboard(client->seat);
+                       wl_keyboard_add_listener(client->keyboard, &keyboard_listener, client);
 
-               client->touch = wl_seat_get_touch(client->seat);
-               wl_touch_add_listener(client->touch, &touch_listener, client);
+                       client->touch = wl_seat_get_touch(client->seat);
+                       wl_touch_add_listener(client->touch, &touch_listener, client);
+               }
        }
        else
        {