From 3203978916a808d2c6c994efe854708790215b3f Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Tue, 7 Apr 2015 17:38:07 +0100 Subject: [PATCH] location: Avoid a division by zero Don't calculate (and therefore update) speed if timestamp on both locations is the same. https://bugs.freedesktop.org/show_bug.cgi?id=89852 --- src/gclue-location.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gclue-location.c b/src/gclue-location.c index eb4877a..338d486 100644 --- a/src/gclue-location.c +++ b/src/gclue-location.c @@ -268,6 +268,8 @@ gclue_location_set_speed_from_prev_location (GClueLocation *location, timestamp = geocode_location_get_timestamp (gloc); prev_timestamp = geocode_location_get_timestamp (prev_gloc); + g_return_if_fail (timestamp != prev_timestamp); + speed = geocode_location_get_distance_from (gloc, prev_gloc) * 1000.0 / (timestamp - prev_timestamp); -- 2.1.0