From 5c50be1bdc3bf5d4f060324c23f5a0ca906dee42 Mon Sep 17 00:00:00 2001 From: Bastian Winkler Date: Thu, 16 Apr 2009 13:06:58 +0200 Subject: [PATCH] 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 --- clutter/clutter-path.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/clutter/clutter-path.c b/clutter/clutter-path.c index 88f4c5685..6b0ba1a4e 100644 --- a/clutter/clutter-path.c +++ b/clutter/clutter-path.c @@ -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; }