From f9ab215bf64be00f303dffc0e1c3eca55c7c28a0 Mon Sep 17 00:00:00 2001 From: Lukasz Oleksak Date: Wed, 19 Oct 2022 12:14:20 +0200 Subject: [PATCH] Add missing nullchecks Change-Id: Iaf0c51165bfb4aff6484cd631b2fa761f9e969d8 --- src/e_mod_main.c | 4 ++++ src/e_screen_reader_gestures.c | 14 +++++++++----- src/e_universal_switch.c | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 52b8362..c2ab871 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -228,7 +228,10 @@ int _e_mod_atspi_dbus_broadcast(Gesture_Info *gi) int cx = 0, cy = 0; zone = e_zone_current_get(); + if (!zone) return -1; + desk = e_desk_current_get(zone); + if (!desk) return -1; e_desk_zoom_get(desk, &zoomx, &zoomy, &cx, &cy); if (zoomx > 1.0 || zoomy > 1.0) @@ -240,6 +243,7 @@ int _e_mod_atspi_dbus_broadcast(Gesture_Info *gi) E_Client *client = e_client_under_position_get(desk, gi->x_beg, gi->y_beg, NULL); + if (!client) return -1; uint32_t resID = e_pixmap_res_id_get(client->pixmap); // Ensure that there is at least one 'ongoing' signal before 'end' in two-finger hover diff --git a/src/e_screen_reader_gestures.c b/src/e_screen_reader_gestures.c index 2d5e55e..588bf36 100644 --- a/src/e_screen_reader_gestures.c +++ b/src/e_screen_reader_gestures.c @@ -124,7 +124,7 @@ _gesture_info_free(void *data, void *info) void app_gesture_support (char *msg) { - if (!strcmp(msg, "all")) + if (!e_util_strcmp(msg, "all")) { app_support_gestures = EINA_TRUE; DEBUG("App support all gestures"); @@ -137,7 +137,7 @@ void app_gesture_support (char *msg) for (k = 0; k < GESTURES_COUNT; ++k) gestures_supported_by_app [k] = EINA_FALSE; - if (!strcmp(msg, "")) + if (!e_util_strcmp(msg, "")) { DEBUG("App support none gestures"); return; @@ -149,7 +149,7 @@ void app_gesture_support (char *msg) int i; for (i = 0; i < n; ++i) { for (k = 0; k < GESTURES_COUNT; ++k) - if (strcmp(list[i], gesture_enum_to_string(k)) == 0) { + if (e_util_strcmp(list[i], gesture_enum_to_string(k)) == 0) { gestures_supported_by_app[k] = EINA_TRUE; break; } @@ -1327,7 +1327,8 @@ _tap_gestures_mouse_down(Ecore_Event_Mouse_Button *ev, Cover *cov) { ERROR("Abort gesture"); cov->tap_gesture_data.started = EINA_FALSE; - ecore_timer_del(cov->tap_gesture_data.timer); + if (cov->tap_gesture_data.timer) + ecore_timer_del(cov->tap_gesture_data.timer); cov->tap_gesture_data.timer = NULL; cov->tap_gesture_data.tap_type = ONE_FINGER_GESTURE; cov->tap_gesture_data.finger[0] = -1; @@ -1464,7 +1465,8 @@ _tap_gestures_move(Ecore_Event_Mouse_Move *ev, Cover *cov) ERROR("Abort tap gesture"); if (cov->n_taps == 2) scrolling = EINA_TRUE; cov->tap_gesture_data.started = EINA_FALSE; - ecore_timer_del(cov->tap_gesture_data.timer); + if (cov->tap_gesture_data.timer) + ecore_timer_del(cov->tap_gesture_data.timer); cov->tap_gesture_data.timer = NULL; cov->tap_gesture_data.tap_type = ONE_FINGER_GESTURE; cov->tap_gesture_data.finger[0] = -1; @@ -1818,8 +1820,10 @@ _gesture_shutdown(void) { if (cover->tap_gesture_data.timer) ecore_timer_del(cover->tap_gesture_data.timer); + cover->tap_gesture_data.timer = NULL; if (cover->hover_gesture.timer) ecore_timer_del(cover->hover_gesture.timer); + cover->hover_gesture.timer = NULL; if (cover->up_timer) ecore_timer_del(cover->up_timer); cover->up_timer = NULL; diff --git a/src/e_universal_switch.c b/src/e_universal_switch.c index 56b82ba..5eb15a4 100644 --- a/src/e_universal_switch.c +++ b/src/e_universal_switch.c @@ -59,7 +59,7 @@ static Eina_Bool _is_intercepted(const char *key) int uncaught_keys_size = sizeof(uncaught_keys) / sizeof(uncaught_keys[0]); for (int i = 0; i < uncaught_keys_size; ++i) - if (strcmp(uncaught_keys[i], key) == 0) + if (e_util_strcmp(uncaught_keys[i], key) == 0) return EINA_FALSE; return EINA_TRUE; @@ -90,7 +90,7 @@ static Eina_Bool _bbi_filter(void *data, void *loop_data, int type, void *event) Ecore_Event_Key *ev = event; - if (strcmp(ev->key, back_button_code) != 0) + if (e_util_strcmp(ev->key, back_button_code) != 0) return EINA_TRUE; if (type == ECORE_EVENT_KEY_DOWN) -- 2.7.4