From 449c0c72b0f6a98540e52208779d1edc68842e16 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Wed, 24 Jul 2013 07:23:58 +0100 Subject: [PATCH] Check for valid returns of ecore_wl_registry_get and ecore_wl_globals_get before trying to use them. After we have bound a text input manager, there is no need to keep looping the globals, so break out. Signed-off-by: Chris Michael --- src/modules/ecore_imf/wayland/wayland_module.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/ecore_imf/wayland/wayland_module.c b/src/modules/ecore_imf/wayland/wayland_module.c index 3689f3a6bd..e0d0c00b56 100644 --- a/src/modules/ecore_imf/wayland/wayland_module.c +++ b/src/modules/ecore_imf/wayland/wayland_module.c @@ -95,8 +95,14 @@ im_module_create() if (!text_input_manager) { Ecore_Wl_Global *global; - struct wl_registry *registry = ecore_wl_registry_get(); - struct wl_list *globals = ecore_wl_globals_get(); + struct wl_registry *registry; + struct wl_list *globals; + + if (!(registry = ecore_wl_registry_get())) + return NULL; + + if (!(globals = ecore_wl_globals_get())) + return NULL; wl_list_for_each(global, globals, link) { @@ -107,6 +113,7 @@ im_module_create() &wl_text_input_manager_interface, 1); EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "bound wl_text_input_manager interface"); + break; } } }