try avoid null ptr derefs.

SVN revision: 79168
This commit is contained in:
Carsten Haitzler 2012-11-12 14:45:59 +00:00
parent 12a2eacfb3
commit 3868f0f91a
2 changed files with 11 additions and 6 deletions

View File

@ -420,7 +420,7 @@ e_desk_current_get(E_Zone *zone)
{ {
E_OBJECT_CHECK_RETURN(zone, NULL); E_OBJECT_CHECK_RETURN(zone, NULL);
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
return e_desk_at_xy_get(zone, zone->desk_x_current, zone->desk_y_current); return e_desk_at_xy_get(zone, zone->desk_x_current, zone->desk_y_current);
} }
@ -435,6 +435,7 @@ e_desk_at_xy_get(E_Zone *zone, int x, int y)
else if ((x < 0) || (y < 0)) else if ((x < 0) || (y < 0))
return NULL; return NULL;
if (!zone->desks) return NULL;
return zone->desks[x + (y * zone->desk_x_count)]; return zone->desks[x + (y * zone->desk_x_count)];
} }

View File

@ -355,12 +355,15 @@ _pager_fill(Pager *p, E_Gadcon *gc)
E_Desk *desk; E_Desk *desk;
desk = e_desk_at_xy_get(p->zone, x, y); desk = e_desk_at_xy_get(p->zone, x, y);
pd = _pager_desk_new(p, desk, x, y, p->invert); if (desk)
if (pd)
{ {
p->desks = eina_list_append(p->desks, pd); pd = _pager_desk_new(p, desk, x, y, p->invert);
if (desk == e_desk_current_get(desk->zone)) if (pd)
_pager_desk_select(pd); {
p->desks = eina_list_append(p->desks, pd);
if (desk == e_desk_current_get(desk->zone))
_pager_desk_select(pd);
}
} }
} }
} }
@ -412,6 +415,7 @@ _pager_desk_new(Pager *p, E_Desk *desk, int xpos, int ypos, Eina_Bool invert)
int w, h; int w, h;
Evas *e; Evas *e;
if (!desk) return NULL;
pd = E_NEW(Pager_Desk, 1); pd = E_NEW(Pager_Desk, 1);
if (!pd) return NULL; if (!pd) return NULL;