Add NULL check code 85/55085/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 21 Dec 2015 23:32:25 +0000 (08:32 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 21 Dec 2015 23:32:25 +0000 (08:32 +0900)
Change-Id: If4907cf54d1be914b09e1a9878cba39e8ca3baa3

scl/sclcontroller.cpp
scl/sclevents.cpp
scl/sclkeyfocushandler.cpp
scl/scluibuilder.cpp
scl/sclutils.cpp
scl/sclwindows.cpp

index a089999..63203b8 100644 (file)
@@ -2050,7 +2050,8 @@ CSCLController::mouse_press(sclwindow window, sclint x, sclint y, scltouchdevice
             if (coordinate) {
                 if (coordinate->multitouch_type == SCL_MULTI_TOUCH_TYPE_GRAB_SUB_EVENTS) {
                     isSubEvent = TRUE;
-                    utils->play_vibration(DEFAULT_VIBRATION_STYLE, DEFAULT_VIBRATION_DURATION);
+                    if (utils)
+                        utils->play_vibration(DEFAULT_VIBRATION_STYLE, DEFAULT_VIBRATION_DURATION);
                 }
             }
         }
@@ -2951,7 +2952,7 @@ CSCLController::mouse_move(sclwindow window, sclint x, sclint y, scltouchdevice
                     desc.mouse_farthest_point = context->get_farthest_move_point(touch_id);
                     desc.key_modifier = key_modifier;
 
-                    if (handler->on_event_drag_state_changed(desc) && context->get_magnifier_enabled()) {
+                    if (handler && handler->on_event_drag_state_changed(desc) && context->get_magnifier_enabled()) {
                         update_magnifier = TRUE;
                     }
                 }
@@ -3620,13 +3621,17 @@ void CSCLController::handle_engine_signal( SclInternalSignal signal, sclwindow t
     switch (signal) {
         case SCL_SIG_SHOW:
             {
-                context->set_hidden_state(FALSE);
+                if (context)
+                    context->set_hidden_state(FALSE);
             }
             break;
         case SCL_SIG_HIDE:
             {
-                context->set_hidden_state(TRUE);
-                windows->close_all_popups();
+                if (context)
+                    context->set_hidden_state(TRUE);
+
+                if (windows)
+                    windows->close_all_popups();
             }
             break;
         case SCL_SIG_START:
@@ -3651,7 +3656,9 @@ void CSCLController::handle_engine_signal( SclInternalSignal signal, sclwindow t
                 break;
             case SIGACTION_RECOMPUTE_LAYOUT: {
                 if (targetWindow != SCLWINDOW_INVALID) {
-                    cache->recompute_layout(targetWindow);
+                    if (cache)
+                        cache->recompute_layout(targetWindow);
+
                     // EFL testing
                     windows->update_window(targetWindow);
                 }
index 18b718f..98f072d 100644 (file)
@@ -151,7 +151,7 @@ CSCLEvents::process_key_event(const char *key)
     } else if ((strcmp(keyname, "Return") == 0)||(strcmp(keyname, "Enter") == 0)) {
         coordinate = cache->get_cur_layout_key_coordinate(current_focus_window, current_key_index);
         //button_context->state = BUTTON_STATE_NORMAL;
-        if (coordinate) {
+        if (coordinate && controller) {
             controller->mouse_press(current_focus_window, coordinate->x, coordinate->y, TRUE);
             controller->mouse_release(current_focus_window, coordinate->x, coordinate->y, TRUE);
             if (KEY_TYPE_MODECHANGE != coordinate->key_type) {
index 4a9917c..2c83d1b 100644 (file)
@@ -474,7 +474,7 @@ CSCLKeyFocusHandler::process_navigation(SCLHighlightNavigationDirection directio
                     if (!(cur_layout->use_sw_background) || cur_layout->bg_color.a != 0) {
                         const PSclInputModeConfigure sclres_input_mode_configure =
                             sclres_manager->get_input_mode_configure_table();
-                        if (sclres_input_mode_configure[window_context->inputmode].use_dim_window) {
+                        if (sclres_input_mode_configure && sclres_input_mode_configure[window_context->inputmode].use_dim_window) {
                             search_in_base_window = FALSE;
                         } else {
                             exclude_popup_covered_area = TRUE;
@@ -539,7 +539,7 @@ CSCLKeyFocusHandler::process_navigation(SCLHighlightNavigationDirection directio
 
             if (exclude_popup_covered_area) {
                 CSCLUtils *utils = CSCLUtils::get_instance();
-                if (utils) {
+                if (utils && popup_window_context) {
                     /* If the base candidate key is covered by popup window, do not choose it */
                     if (utils->is_rect_overlap(base_key_coordinate, popup_window_context->geometry)) {
                         base_candidate.candidate = NOT_USED;
index 665910b..c308387 100644 (file)
@@ -1012,9 +1012,11 @@ CSCLUIBuilder::show_magnifier(const sclwindow window, scldrawctx draw_ctx)
         /* Do not show if there's nothing to show */
         //const char *targetstr = coordinate->key_value[shift_index][button_context->multikeyIdx];
         const char *targetstr = coordinate->label[shift_index][0];
-        if (state->get_cur_action_state() == ACTION_STATE_BASE_LONGKEY ||
-            state->get_cur_action_state() == ACTION_STATE_POPUP_LONGKEY ) {
+        if (state) {
+            if (state->get_cur_action_state() == ACTION_STATE_BASE_LONGKEY ||
+                state->get_cur_action_state() == ACTION_STATE_POPUP_LONGKEY) {
                 targetstr = coordinate->long_key_value;
+            }
         }
         const sclchar* customstr = NULL;
         for(sclint label_index = 0;label_index < MAX_SIZE_OF_LABEL_FOR_ONE && !customstr;label_index++) {
@@ -1058,7 +1060,7 @@ CSCLUIBuilder::show_magnifier(const sclwindow window, scldrawctx draw_ctx)
     }
     if (coordinate && magnifier_configure) {
         sclchar composed_path[_POSIX_PATH_MAX] = {0,};
-        if (state->get_cur_action_state() == ACTION_STATE_BASE_LONGKEY) {
+        if (state && state->get_cur_action_state() == ACTION_STATE_BASE_LONGKEY) {
             m_utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_long_key_image_path);
             m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, 0,
                 magnifier_configure->width * utils->get_custom_scale_rate_x(),
@@ -1117,8 +1119,10 @@ CSCLUIBuilder::show_magnifier(const sclwindow window, scldrawctx draw_ctx)
                             targetstr = cache->find_substituted_string(targetstr);
                         } else if (loop == 0) {
                             /* Don't display sublabels of each buttons in magnifier window - this policy can be changed, but for now */
-                            targetstr = coordinate->label[shift_index][button_context->multikeyIdx];
-                            targetstr = cache->find_substituted_string(targetstr);
+                            if (button_context) {
+                                targetstr = coordinate->label[shift_index][button_context->multikeyIdx];
+                                targetstr = cache->find_substituted_string(targetstr);
+                            }
                         }
                         if (targetstr) {
                             draw_magnifier_label(window, draw_ctx, loop, targetstr);
index c9d4ce8..e33b54a 100644 (file)
@@ -75,7 +75,7 @@ CSCLUtils::init()
         scl_assert(default_configure->target_screen_width);
         scl_assert(default_configure->target_screen_height);
         if (default_configure->target_screen_width != 0 &&default_configure->target_screen_height != 0) {
-            GetCSCLUtilsImpl()->get_screen_resolution(&m_scn_resolution_x, &m_scn_resolution_y);
+            impl->get_screen_resolution(&m_scn_resolution_x, &m_scn_resolution_y);
             m_scn_rate_x = m_scn_resolution_x / (float)default_configure->target_screen_width;
             m_scn_rate_y = m_scn_resolution_y / (float)default_configure->target_screen_height;
 
index 40141d3..ddb6998 100644 (file)
@@ -263,7 +263,8 @@ sclwindow CSCLWindows::open_popup(const SclWindowOpener opener, const SclRectang
                     button_context->state = BUTTON_STATE_NORMAL;
                 }*/
 
-                windows->update_window(window, coordinate->x, coordinate->y, coordinate->width, coordinate->height);
+                if (coordinate)
+                    windows->update_window(window, coordinate->x, coordinate->y, coordinate->width, coordinate->height);
             }
         }
     }
@@ -314,6 +315,8 @@ CSCLWindows::create_base_window(const sclwindow parent, scl16 width, scl16 heigh
     SCL_DEBUG();
 
     if (m_initialized) {
+        CSCLWindowsImpl* impl = get_scl_windows_impl();
+
         m_base_window_context.hidden = TRUE;
         m_base_window_context.geometry.width = width;
         m_base_window_context.geometry.height = height;
@@ -322,10 +325,12 @@ CSCLWindows::create_base_window(const sclwindow parent, scl16 width, scl16 heigh
         m_base_window_context.opener.window = parent;
         m_base_window_context.geometry.x = m_base_window_context.geometry.y = 0;
         m_base_window_context.etc_info = NULL;
-        m_base_window_context.window =
-            get_scl_windows_impl()->create_base_window(parent, &m_base_window_context, width, height);
+        m_base_window_context.window = SCLWINDOW_INVALID;
 
-        push_window_in_Z_order_list(m_base_window_context.window);
+        if (impl) {
+            m_base_window_context.window = impl->create_base_window(parent, &m_base_window_context, width, height);
+            push_window_in_Z_order_list(m_base_window_context.window);
+        }
     }
 
     // Update the position information