layout: Don't assume we have background surface set-up 05/30105/1 18.90.0 salmon/18.90.0 salmon_18.90.0
authorMarius Vlad <marius.vlad@collabora.com>
Tue, 16 Jul 2024 09:14:34 +0000 (12:14 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Tue, 16 Jul 2024 09:14:34 +0000 (12:14 +0300)
set_background request assumes we have set-up a bg surface which might
not be the always case. Just avoid dereferencing before testing for a
valid background surface role.

Bug-AGL: SPEC-5205
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I3481d7eda83c8d6e7605dc0e8fec240029405808

src/layout.c

index 48c478e..90f7a1b 100644 (file)
@@ -144,14 +144,14 @@ ivi_background_init(struct ivi_compositor *ivi, struct ivi_output *output)
        struct weston_output *woutput = output->output;
        struct ivi_surface *bg = output->background;
        struct weston_view *view;
-       struct weston_surface *wsurface =
-               weston_desktop_surface_get_surface(bg->dsurface);
+       struct weston_surface *wsurface;
 
        if (!bg) {
                weston_log("WARNING: Output does not have a background\n");
                return;
        }
 
+       wsurface = weston_desktop_surface_get_surface(bg->dsurface);
        assert(bg->role == IVI_SURFACE_ROLE_BACKGROUND);
 
        view = bg->view;