Fix defects detected by static analysis tool 12/169512/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 7 Feb 2018 07:02:58 +0000 (16:02 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Wed, 7 Feb 2018 07:02:58 +0000 (16:02 +0900)
Change-Id: I8fe7848562ce91d849490357db69662522e5a326

src/ise.cpp

index 3ad0019..e2a7558 100644 (file)
@@ -1317,8 +1317,10 @@ ise_show(int ic)
         read_ise_config_values();
 
         _language_manager.set_enabled_languages(g_config_values.enabled_languages);
+        const sclchar *cur_lang = _language_manager.get_current_language();
+
 #ifdef _WEARABLE
-        if (!strcmp(_language_manager.get_current_language(), "English") ){
+        if (cur_lang && !strcmp(cur_lang, "English")) {
             if (!g_config_values.prediction_on ||
                     (g_keyboard_state.layout == ISE_LAYOUT_STYLE_PHONENUMBER ||
                 g_keyboard_state.layout == ISE_LAYOUT_STYLE_VOICE ||
@@ -1379,7 +1381,6 @@ ise_show(int ic)
 
         g_keyboard_state.ic = ic;
         /* Reset input mode if the current language is not the selected language */
-        const sclchar *cur_lang = _language_manager.get_current_language();
         if (cur_lang) {
             if (g_config_values.selected_language.compare(cur_lang) != 0) {
                 reset_inputmode = TRUE;
@@ -2636,7 +2637,8 @@ static void ime_app_caps_mode_changed_cb(int mode, void *user_data)
 static void ime_app_candidate_show_cb(int context_id, void *user_data)
 {
 #ifdef _WEARABLE
-    if (!strcmp(_language_manager.get_current_language(), "English")){
+    const sclchar *cur_lang = _language_manager.get_current_language();
+    if (cur_lang && !strcmp(cur_lang, "English")) {
         if (!g_config_values.prediction_on ||
                 (g_keyboard_state.layout == ISE_LAYOUT_STYLE_PHONENUMBER ||
                 g_keyboard_state.layout == ISE_LAYOUT_STYLE_VOICE ||
@@ -2663,7 +2665,8 @@ static void ime_app_candidate_show_cb(int context_id, void *user_data)
 static void ime_app_candidate_hide_cb(int context_id, void *user_data)
 {
 #ifdef _WEARABLE
-    if (!strcmp(_language_manager.get_current_language(), "English")){
+    const sclchar *cur_lang = _language_manager.get_current_language();
+    if (cur_lang && !strcmp(cur_lang, "English")) {
         if (!g_config_values.prediction_on ||
                 (g_keyboard_state.layout == ISE_LAYOUT_STYLE_PHONENUMBER ||
                 g_keyboard_state.layout == ISE_LAYOUT_STYLE_VOICE ||