From 7df329907058efc937efc58fb55aaca40dad4f52 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Fri, 18 May 2018 13:46:28 -0400 Subject: [PATCH] efl_input_device: Fix seat_get Summary: This was testing the same thing twice. Reviewers: zmike Reviewed By: zmike Subscribers: cedric, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6180 --- src/lib/efl/interfaces/efl_input_device.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/efl/interfaces/efl_input_device.c b/src/lib/efl/interfaces/efl_input_device.c index aed03c9980..4924f1f9d0 100644 --- a/src/lib/efl/interfaces/efl_input_device.c +++ b/src/lib/efl/interfaces/efl_input_device.c @@ -151,13 +151,17 @@ _efl_input_device_seat_id_get(const Eo *obj, Efl_Input_Device_Data *pd) EOLIAN static Efl_Input_Device * _efl_input_device_seat_get(const Eo *obj, Efl_Input_Device_Data *pd) { - for (; obj; obj = efl_parent_get(obj)) - { - if (pd->klass == EFL_INPUT_DEVICE_TYPE_SEAT) - return pd->eo; + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + if (pd->klass == EFL_INPUT_DEVICE_TYPE_SEAT) + return pd->eo; + + while ((obj = efl_parent_get(obj))) + { if (!efl_isa(obj, MY_CLASS)) break; pd = efl_data_scope_get(obj, MY_CLASS); + if (pd->klass == EFL_INPUT_DEVICE_TYPE_SEAT) + return pd->eo; } return NULL;