zoom: Check the value of level before using it.
authorCarlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
Sat, 17 Jan 2015 19:31:53 +0000 (20:31 +0100)
committerBryce Harrington <bryce@osg.samsung.com>
Wed, 21 Jan 2015 02:33:43 +0000 (18:33 -0800)
Check the value of level before dividing 1 by it.

Signed-off-by: Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
src/zoom.c

index 7553849..f71d08c 100644 (file)
@@ -120,12 +120,13 @@ weston_output_update_zoom_transform(struct weston_output *output)
        float ratio, level;
 
        level = output->zoom.spring_z.current;
-       ratio = 1 / level;
 
        if (!output->zoom.active || level > output->zoom.max_level ||
            level == 0.0f)
                return;
 
+       ratio = 1 / level;
+
        if (wl_list_empty(&output->zoom.animation_xy.link))
                zoom_area_center_from_pointer(output, &x, &y);