edje_data: Adding null check to mem_alloc function 77/291077/4
authorb.chrescionk <b.chrescionk@samsung.com>
Wed, 29 Mar 2023 08:18:49 +0000 (10:18 +0200)
committerb.chrescionk <b.chrescionk@samsung.com>
Fri, 14 Apr 2023 10:36:39 +0000 (12:36 +0200)
@tizen_only

Change-Id: If4893ad47dbbb00c4cd819790e1a022d4df8b86f

src/lib/edje/edje_data.c

index d36db8f..45eb59a 100644 (file)
@@ -98,10 +98,16 @@ Eet_Data_Descriptor *_edje_edd_edje_part_description_vector_pointer = NULL;
      Edje_Part_Description_Common *data;            \
                                                     \
      data = eina_mempool_malloc(_emp_##Type, size); \
-     memset(data, 0, size);                         \
-     data->clip_to_id = -1;                         \
-     data->map.zoom.x = data->map.zoom.y = 1.0;     \
-     data->map.zoom.id_center = -1;                 \
+     // TIZEN_ONLY(20230404): Add null check for data to prevent crash from calling methods on null object
+     if (data != NULL)                              \
+     {                                              \
+        memset(data, 0, size);                      \
+        data->clip_to_id = -1;                      \
+        data->map.zoom.x = data->map.zoom.y = 1.0;  \
+        data->map.zoom.id_center = -1;              \
+     }                                              \
+     //
+                                                    \
      return data;                                   \
   }                                                 \
                                                     \