Fix defect detected by static analysis tool 12/250812/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 5 Jan 2021 02:50:23 +0000 (11:50 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 5 Jan 2021 02:51:50 +0000 (11:51 +0900)
Return value of a function 'get_candidate' is dereferenced at ise.cpp:2596 without checking,
but it is usually checked for this function (74/80).

Change-Id: Ia68b00104cd154932eb540ba5752cd333280365c
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/ise.cpp

index eb4160c..1aa4bb9 100644 (file)
@@ -2593,13 +2593,15 @@ static void set_ime_size(bool floating_mode, ISE_CANDIDATE_REQUEST candidate_req
                 }
                 break;
             case ISE_CANDIDATE_REQ_SHOW:
-                ui->set_custom_starting_coordinates(0, FLOATING_TITLE_BAR_HEIGHT + candidate->get_height());
-                if (g_input_panel_show || g_candidate_more_view) {
-                    size_portrait.height += candidate->get_height();
-                    size_landscape.height += candidate->get_height();
-                } else {
-                    size_portrait.height = candidate->get_height();
-                    size_landscape.height = candidate->get_height();
+                if (candidate) {
+                    ui->set_custom_starting_coordinates(0, FLOATING_TITLE_BAR_HEIGHT + candidate->get_height());
+                    if (g_input_panel_show || g_candidate_more_view) {
+                        size_portrait.height += candidate->get_height();
+                        size_landscape.height += candidate->get_height();
+                    } else {
+                        size_portrait.height = candidate->get_height();
+                        size_landscape.height = candidate->get_height();
+                    }
                 }
                 break;
             case ISE_CANDIDATE_REQ_HIDE: