Prevent a possible zero division

A zero division might occur in clutter_path_get_position if the length
of a curved node is zero.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Bastian Winkler 2009-04-16 13:06:58 +02:00 committed by Neil Roberts
parent 56ac4baf17
commit 5c50be1bdc

View File

@ -1421,10 +1421,15 @@ clutter_path_get_position (ClutterPath *path,
break;
case CLUTTER_PATH_CURVE_TO:
_clutter_bezier_advance (node->bezier,
point_distance * CLUTTER_BEZIER_MAX_LENGTH
/ node->length,
position);
if (node->length == 0)
*position = node->k.points[2];
else
{
_clutter_bezier_advance (node->bezier,
point_distance * CLUTTER_BEZIER_MAX_LENGTH
/ node->length,
position);
}
break;
}