[path] Do not accept NULL descriptions

Bug 1465 - clutter_path_parse_description should check p==NULL

When accepting a stringified path description, ClutterPath methods
and the parser should not accept NULL or empty strings.
This commit is contained in:
Emmanuele Bassi 2009-02-20 11:17:52 +00:00
parent 96317854c8
commit effbbe2e1e

View File

@ -568,8 +568,11 @@ static gboolean
clutter_path_parse_description (const gchar *p, clutter_path_parse_description (const gchar *p,
GSList **ret) GSList **ret)
{ {
GSList *nodes = NULL;
ClutterPathNodeFull *node; ClutterPathNodeFull *node;
GSList *nodes = NULL;
if (p == NULL || *p == '\0')
return FALSE;
while (TRUE) while (TRUE)
{ {
@ -720,6 +723,7 @@ clutter_path_add_string (ClutterPath *path,
GSList *nodes; GSList *nodes;
g_return_val_if_fail (CLUTTER_IS_PATH (path), FALSE); g_return_val_if_fail (CLUTTER_IS_PATH (path), FALSE);
g_return_val_if_fail (str != NULL, FALSE);
if (clutter_path_parse_description (str, &nodes)) if (clutter_path_parse_description (str, &nodes))
{ {
@ -1099,11 +1103,13 @@ clutter_path_replace_node (ClutterPath *path,
* Since: 1.0 * Since: 1.0
*/ */
gboolean gboolean
clutter_path_set_description (ClutterPath *path, const gchar *str) clutter_path_set_description (ClutterPath *path,
const gchar *str)
{ {
GSList *nodes; GSList *nodes;
g_return_val_if_fail (CLUTTER_IS_PATH (path), FALSE); g_return_val_if_fail (CLUTTER_IS_PATH (path), FALSE);
g_return_val_if_fail (str != NULL, FALSE);
if (clutter_path_parse_description (str, &nodes)) if (clutter_path_parse_description (str, &nodes))
{ {