From eeef98212f9256699f5420cf192d8ba41ee065ed Mon Sep 17 00:00:00 2001 From: Mateusz Polrola Date: Mon, 30 May 2016 10:36:00 +0900 Subject: ivi-controller: do not iterate over empty list in send_surface_add_event Iterating over empty list will modify first value passed to wl_list_for_each, but that won't be valid list entry, which in case of send_surface_add_even leads to crash. V2 change: Use break instead of continue Signed-off-by: Mateusz Polrola Signed-off-by: Wataru Natsume --- weston-ivi-shell/src/ivi-controller-impl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/weston-ivi-shell/src/ivi-controller-impl.c b/weston-ivi-shell/src/ivi-controller-impl.c index 8c89904..af79ded 100644 --- a/weston-ivi-shell/src/ivi-controller-impl.c +++ b/weston-ivi-shell/src/ivi-controller-impl.c @@ -165,6 +165,10 @@ send_surface_add_event(struct ivisurface *ivisurf, for (i = 0; i < (int)length; i++) { /* Send new surface event */ ivilayer = NULL; + if (wl_list_empty(&shell->list_layer)) { + break; + } + wl_list_for_each(ivilayer, &shell->list_layer, link) { if (ivilayer->layout_layer == pArray[i]) { break; -- cgit v1.2.1