[actor] Check out parameters before setting them

The clutter_actor_get_rotation() out parameters may be NULL, so
we need to check before dereferencing them.
This commit is contained in:
Emmanuele Bassi 2009-02-11 17:56:22 +00:00
parent 82db27874b
commit 402e022c36

View File

@ -2617,7 +2617,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_double ("rotation-angle-x", g_param_spec_double ("rotation-angle-x",
"Rotation Angle X", "Rotation Angle X",
"The rotation angle on the X axis", "The rotation angle on the X axis",
0.0, -G_MAXDOUBLE,
G_MAXDOUBLE, G_MAXDOUBLE,
0.0, 0.0,
CLUTTER_PARAM_READWRITE)); CLUTTER_PARAM_READWRITE));
@ -2634,7 +2634,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_double ("rotation-angle-y", g_param_spec_double ("rotation-angle-y",
"Rotation Angle Y", "Rotation Angle Y",
"The rotation angle on the Y axis", "The rotation angle on the Y axis",
0.0, -G_MAXDOUBLE,
G_MAXDOUBLE, G_MAXDOUBLE,
0.0, 0.0,
CLUTTER_PARAM_READWRITE)); CLUTTER_PARAM_READWRITE));
@ -2651,7 +2651,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_double ("rotation-angle-z", g_param_spec_double ("rotation-angle-z",
"Rotation Angle Z", "Rotation Angle Z",
"The rotation angle on the Z axis", "The rotation angle on the Z axis",
0.0, -G_MAXDOUBLE,
G_MAXDOUBLE, G_MAXDOUBLE,
0.0, 0.0,
CLUTTER_PARAM_READWRITE)); CLUTTER_PARAM_READWRITE));
@ -5803,9 +5803,14 @@ clutter_actor_get_rotation (ClutterActor *self,
angle = clutter_actor_get_rotationu (self, axis, &xu, &yu, &zu); angle = clutter_actor_get_rotationu (self, axis, &xu, &yu, &zu);
*x = CLUTTER_UNITS_TO_DEVICE (xu); if (x)
*y = CLUTTER_UNITS_TO_DEVICE (yu); *x = CLUTTER_UNITS_TO_DEVICE (xu);
*z = CLUTTER_UNITS_TO_DEVICE (zu);
if (y)
*y = CLUTTER_UNITS_TO_DEVICE (yu);
if (z)
*z = CLUTTER_UNITS_TO_DEVICE (zu);
return angle; return angle;
} }