agl-compositor: Add NULL check after creating surface/view 61/27061/1
authorAndyZhou <zhoumy@cn.fujitsu.com>
Wed, 22 Dec 2021 10:54:49 +0000 (18:54 +0800)
committerAndyZhou <zhoumy@cn.fujitsu.com>
Wed, 22 Dec 2021 10:54:49 +0000 (18:54 +0800)
Add a check to verify if both the surface/view was created successfully
in function create_black_surface_view of src/shell.c file.

Bug-AGL: SPEC-4193

Signed-off-by: ZhouMingying <zhoumy@cn.fujitsu.com>
Change-Id: I69c6a6023c8b7a3b6e376f3cba25020a851648ab

src/shell.c

index 048cbeb..f874fd0 100644 (file)
@@ -876,9 +876,13 @@ create_black_surface_view(struct ivi_output *output)
                return;
 
        surface = weston_surface_create(wc);
+       if (!surface)
+               return;
        view = weston_view_create(surface);
-
-       assert(view || surface);
+       if (!view) {
+               weston_surface_destroy(surface);
+               return;
+       }
 
        weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1);
        weston_surface_set_size(surface, woutput->width, woutput->height);