Fix dereference of NULL return issue 76/87276/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 7 Sep 2016 07:49:01 +0000 (16:49 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 7 Sep 2016 07:49:01 +0000 (16:49 +0900)
Return value of a function 'scl::CSCLKeyFocusHandler::get_instance' is dereferenced at sclresourcecache.cpp:990 without checking, but it is usually checked for this function (4/5).

Change-Id: I8d2f0cf375262c0102a80aa1f86b4c12630cf2e7
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
scl/include/sclui.h
scl/sclresourcecache.cpp

index e9fe2ca..34f130c 100644 (file)
@@ -452,4 +452,4 @@ private:
 
 //SCL_END_DECLS
 
-#endif //__SCL_CORE_H__
+#endif //__SCL_UI_H__
index 727775c..39c6838 100644 (file)
@@ -986,13 +986,17 @@ CSCLResourceCache::recompute_layout(sclwindow window)
                     }
 
                     CSCLKeyFocusHandler* focus_handler = CSCLKeyFocusHandler::get_instance();
-                    //reset navigation info
-                    focus_handler->reset_key_navigation_info(window);
+                    if (focus_handler) {
+                        //reset navigation info
+                        focus_handler->reset_key_navigation_info(window);
+                    }
                     for (loop = 0;loop < MAX_KEY;loop++) {
                         SclLayoutKeyCoordinatePointer p = sclres_layout_key_coordinate_pointer_frame[layout][loop];
                         if (p && p->valid) {
-                            //BUILDING KEY NAVIGATION INFO
-                            focus_handler->update_key_navigation_info(window, loop, p);
+                            if (focus_handler) {
+                                //BUILDING KEY NAVIGATION INFO
+                                focus_handler->update_key_navigation_info(window, loop, p);
+                            }
                             //BUILDING KEY NAVIGATION INFO COMPLETED
                             (*pCurButtonContext)[loop].used = TRUE;
                             if (popupindex != NOT_USED) {
@@ -1046,8 +1050,11 @@ CSCLResourceCache::recompute_layout(sclwindow window)
                             }
                         }
                     }
-                    //finalize navigation info
-                    focus_handler->finalize_key_navigation_info(window);
+
+                    if (focus_handler) {
+                        //finalize navigation info
+                        focus_handler->finalize_key_navigation_info(window);
+                    }
                 }
             }