[evas_sw] add check for null 37/123237/4
authorJoogab Yun <joogab.yun@samsung.com>
Fri, 24 Mar 2017 01:34:26 +0000 (10:34 +0900)
committerjoogab yun <joogab.yun@samsung.com>
Wed, 5 Apr 2017 08:37:11 +0000 (01:37 -0700)
there was no null check for native value

Change-Id: If01700f430a1c5f2ec0519f25a5dc45ca2a55d6e

src/modules/evas/engines/software_tbm/evas_engine.c

index 8d0618f..4be4c8f 100644 (file)
@@ -225,35 +225,37 @@ eng_image_native_set(void *data EINA_UNUSED, void *image, void *native)
 
    if (!im) return im;
 
-   if (ns->type == EVAS_NATIVE_SURFACE_TBM)
-     {
-        if (im->native.data)
-          {
-             //image have native surface already
-             Evas_Native_Surface *ens = im->native.data;
-
-             if ((ens->type == ns->type) &&
-                 (ens->data.tbm.buffer == ns->data.tbm.buffer))
-                return im;
-          }
-      }
-   else if (ns->type == EVAS_NATIVE_SURFACE_WL)
+   if (ns)
      {
-        if (im->native.data)
-          {
-             Evas_Native_Surface *ens;
+       if (ns->type == EVAS_NATIVE_SURFACE_TBM)
+         {
+           if (im->native.data)
+             {
+               //image have native surface already
+               Evas_Native_Surface *ens = im->native.data;
+               if ((ens->type == ns->type) &&
+                   (ens->data.tbm.buffer == ns->data.tbm.buffer))
+                 return im;
+             }
+         }
+       else if (ns->type == EVAS_NATIVE_SURFACE_WL)
+         {
+           if (im->native.data)
+             {
+               Evas_Native_Surface *ens;
+
+               ens = im->native.data;
+               if (ens->data.wl.legacy_buffer == ns->data.wl.legacy_buffer)
+                 return im;
+             }
+         }
 
-             ens = im->native.data;
-             if (ens->data.wl.legacy_buffer == ns->data.wl.legacy_buffer)
-               return im;
-          }
+       im2 = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
+                                                 ie->w, ie->h,
+                                                 NULL, 1,
+                                                 EVAS_COLORSPACE_ARGB8888);
      }
 
-   im2 = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
-                                 ie->w, ie->h,
-                                 NULL, 1,
-                                 EVAS_COLORSPACE_ARGB8888);
-
    if (im->native.data)
       {
          if (im->native.func.free)