summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndyZhou <zhoumy@cn.fujitsu.com>2021-12-22 18:54:49 +0800
committerAndyZhou <zhoumy@cn.fujitsu.com>2021-12-22 18:54:49 +0800
commit838df78fe94e5bbb653bb123b2cb0aac1db0bfb1 (patch)
treed4dfc9f9adee794b532a25e605a035d6a5e61a66
parent471a12ee38098aaac86e5a9a8e256fd88cd67c0a (diff)
agl-compositor: Add NULL check after creating surface/view
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
-rw-r--r--src/shell.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/shell.c b/src/shell.c
index 048cbeb..f874fd0 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -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);