forked from enlightenment/efl
gfx: Add NULL check to silence coverity
realloc() can return NULL if size is 0. It's like free(). So, the usage here is correct, and there are probably no points to interpolate between anyway. I wonder if there can be commands without points, though. Fixes CID 1293004
This commit is contained in:
parent
1b6825d3fe
commit
9cf72fe80a
|
@ -318,7 +318,7 @@ _efl_gfx_shape_interpolate(Eo *obj, Efl_Gfx_Shape_Data *pd,
|
||||||
Efl_Gfx_Path_Command *cmds;
|
Efl_Gfx_Path_Command *cmds;
|
||||||
Efl_Gfx_Property property_from, property_to;
|
Efl_Gfx_Property property_from, property_to;
|
||||||
Efl_Gfx_Dash *dash = NULL;
|
Efl_Gfx_Dash *dash = NULL;
|
||||||
double *pts, *from_pts, *to_pts;
|
double *pts;
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
from_pd = eo_data_scope_get(from, EFL_GFX_SHAPE_MIXIN);
|
from_pd = eo_data_scope_get(from, EFL_GFX_SHAPE_MIXIN);
|
||||||
|
@ -351,18 +351,21 @@ _efl_gfx_shape_interpolate(Eo *obj, Efl_Gfx_Shape_Data *pd,
|
||||||
memcpy(cmds, from_pd->commands,
|
memcpy(cmds, from_pd->commands,
|
||||||
sizeof (Efl_Gfx_Path_Command) * from_pd->commands_count);
|
sizeof (Efl_Gfx_Path_Command) * from_pd->commands_count);
|
||||||
|
|
||||||
to_pts = to_pd->points;
|
if (pts)
|
||||||
from_pts = from_pd->points;
|
{
|
||||||
|
double *to_pts = to_pd->points;
|
||||||
|
double *from_pts = from_pd->points;
|
||||||
|
|
||||||
for (i = 0; cmds[i] != EFL_GFX_PATH_COMMAND_TYPE_END; i++)
|
for (i = 0; cmds[i] != EFL_GFX_PATH_COMMAND_TYPE_END; i++)
|
||||||
for (j = 0; j < _efl_gfx_path_command_length(cmds[i]); j++)
|
for (j = 0; j < _efl_gfx_path_command_length(cmds[i]); j++)
|
||||||
{
|
{
|
||||||
*pts = interpolate(*from_pts, *to_pts, pos_map);
|
*pts = interpolate(*from_pts, *to_pts, pos_map);
|
||||||
|
|
||||||
pts++;
|
pts++;
|
||||||
from_pts++;
|
from_pts++;
|
||||||
to_pts++;
|
to_pts++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pd->points_count = from_pd->points_count;
|
pd->points_count = from_pd->points_count;
|
||||||
|
|
Loading…
Reference in New Issue