efl_ui_grid: Fix dereferencing null pointer
authorChristopher Michael <cp.michael@samsung.com>
Thu, 14 Mar 2019 11:22:44 +0000 (07:22 -0400)
committerYeongjong Lee <yj34.lee@samsung.com>
Tue, 2 Apr 2019 03:45:17 +0000 (12:45 +0900)
Summary:
Coverity reports EFL_UI_GRID_ITEM_DATA_GET can return NULL (checked
273 out of 281 times). As such, we should verify that 'id' is not NULL
here before trying to dereference it.

Fixes Coverity CID1397000

@fix

Depends on D8318

Reviewers: raster, cedric, q66, zmike, bu5hm4n, stefan

Reviewed By: cedric

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8319

src/lib/elementary/efl_ui_grid.c

index 58cacdd..9c8b597 100644 (file)
@@ -167,6 +167,7 @@ _reposition(Eo *obj EINA_UNUSED, Efl_Ui_Grid_Data *pd, Eina_Position2D pan)
    EINA_LIST_FOREACH(pd->items, l, item)
      {
         EFL_UI_GRID_ITEM_DATA_GET(item, id);
+        if (!id) continue;
 
         ipos.x = id->geo.x - pan.x;
         ipos.y = id->geo.y - pan.y;