shell: Fix a potential NULL pointer dereference
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 25 Nov 2013 18:01:45 +0000 (18:01 +0000)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 2 Dec 2013 19:44:51 +0000 (11:44 -0800)
get_shell_surface() may return NULL. Found by scan-build.

src/shell.c

index abed1c7..804a57e 100644 (file)
@@ -1373,7 +1373,8 @@ take_surface_to_workspace_by_seat(struct desktop_shell *shell,
            workspace_has_only(to, surface))
                update_workspace(shell, index, from, to);
        else {
-               if (wl_list_empty(&shsurf->workspace_transform.link))
+               if (shsurf != NULL &&
+                   wl_list_empty(&shsurf->workspace_transform.link))
                        wl_list_insert(&shell->workspaces.anim_sticky_list,
                                       &shsurf->workspace_transform.link);