Fix svace issue 31/262531/2 accepted/tizen/unified/20210826.123539 submit/tizen/20210813.035334 submit/tizen/20210826.001725
authorhuiyu.eun <huiyu.eun@samsung.com>
Fri, 13 Aug 2021 02:31:29 +0000 (11:31 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Fri, 13 Aug 2021 02:33:41 +0000 (11:33 +0900)
Fix 'DEREF_OF_NULL'
- Add null checker

Change-Id: Icb5b8a74bc652a165397df6a7d55920c3c1502e8
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/video/tizen/SDL_tizenwindow.c

index ff13b75..da12fc6 100755 (executable)
@@ -183,6 +183,12 @@ _cb_client_data(void *data, int type EINA_UNUSED, void *event)
 
     SDL_VideoData* videoData = SDL_GetVideoDevice()->driverdata;
     SDL_Window * window = (SDL_Window*)eina_hash_find(videoData->windows, &videoData->indicator_parent_id);
+    if (!window)
+    {
+        SDL_Log("window is null");
+        return ECORE_CALLBACK_PASS_ON;
+    }
+
     switch(epcEvent->major)
     {
     case OP_INDICATOR_INIT:
@@ -517,7 +523,14 @@ _tizen_window_orientaiton_hint_callback(void *userdata, const char *name, const
         }
     }
 
-    Tizen_rotate_update(Tizen_FindWindow(SDL_GetVideoDevice(), window));
+    SDL_Window *sdl_window = Tizen_FindWindow(SDL_GetVideoDevice(), window);
+    if (!sdl_window)
+    {
+        SDL_Log("Rotate error: sdl_window is null");
+        return;
+    }
+
+    Tizen_rotate_update(sdl_window);
 }
 
 void
@@ -1297,7 +1310,17 @@ static Eina_Bool _tizen_cb_event_window_show(void *data, int type, void *event)
     {
         SDL_VideoData *this = SDL_GetVideoDevice()->driverdata;
         SDL_Window * window = (SDL_Window*)eina_hash_find(this->windows, &e->win);
+        if (!window)
+        {
+            SDL_Log("window is null");
+            return ECORE_CALLBACK_PASS_ON;
+        }
         SDL_WindowData *wind = window->driverdata;
+        if (!wind)
+        {
+            SDL_Log("window->driverdata is null");
+            return ECORE_CALLBACK_PASS_ON;
+        }
         wind->g_res_id = g_res_id;
         SDL_Log("[SDL] SDL Window Resource ID %d", g_res_id);
     }