Fix issue detected by static analysis tool 95/151195/3
authorInHong Han <inhong1.han@samsung.com>
Wed, 20 Sep 2017 07:32:50 +0000 (16:32 +0900)
committerInHong Han <inhong1.han@samsung.com>
Wed, 20 Sep 2017 07:54:27 +0000 (16:54 +0900)
Change-Id: Ic0574aa9889ad6824a8f93baaed8419ccebda3db

src/ise.cpp

index 37cdf6c..66328bd 100644 (file)
@@ -377,8 +377,7 @@ static bool ise_is_emoticons_disabled(void)
 
 static Eina_Bool softcandidate_hide_timer_callback(void *data)
 {
-    if (g_ui)
-        set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_HIDE);
+    set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_HIDE);
 
     if (g_candidate) {
         g_candidate->hide();
@@ -1518,7 +1517,7 @@ ise_hide()
     }
 
     g_input_panel_show = false;
-    if (g_softcandidate_show && g_ui && g_candidate)
+    if (g_softcandidate_show && g_candidate)
         set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_SHOW);
 #ifdef _WEARABLE
     hide_indicator_window();
@@ -1593,13 +1592,10 @@ static void ise_floating_mode_changed_cb(const char *key, void *user_data)
         g_candidate = NULL;
 
         create_softcandidate();
-        if (g_candidate->get_visible()) {
+        if (g_candidate && g_candidate->get_visible()) {
             g_softcandidate_show = true;
-            if (g_candidate) {
-                g_candidate->show();
-                if (g_ui)
-                    set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_SHOW);
-            }
+            g_candidate->show();
+            set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_SHOW);
             return;
         }
     }
@@ -1757,8 +1753,7 @@ ise_app_candidate_show()
     g_softcandidate_show = true;
     if (g_candidate) {
         g_candidate->show();
-        if (g_ui)
-            set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_SHOW);
+        set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_SHOW);
     }
 }
 
@@ -2033,6 +2028,9 @@ static void update_recent_used_punctuation(const char * key_value)
 
 static void set_ime_size(bool floating_mode, ISE_CANDIDATE_REQUEST candidate_req)
 {
+    if (!g_ui)
+        return;
+
     SclSize size_portrait = g_ui->get_input_mode_size(g_ui->get_input_mode(), DISPLAYMODE_PORTRAIT);
     SclSize size_landscape = g_ui->get_input_mode_size(g_ui->get_input_mode(), DISPLAYMODE_LANDSCAPE);