summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>2015-09-09 20:38:52 +0100
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>2015-09-10 14:14:07 +0100
commitedd54c5be19ca3a6a1cd217638a6988d90735787 (patch)
tree66d0aff31f6aa556bbe47c8b6ca9d7f4a7fcd26d
parent031904f4e36c8f775c6efd3a541597727f609fd9 (diff)
location: Correctly handle same timestamp case
Same timestamp on new and previous locations, is not programmer error and hence use of g_return_if_fail() for this case would be wrong. Instead simply set the speed to unknown in such cases.
-rw-r--r--src/gclue-location.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gclue-location.c b/src/gclue-location.c
index f0702b5..773cc9f 100644
--- a/src/gclue-location.c
+++ b/src/gclue-location.c
@@ -404,7 +404,11 @@ 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);
+ if (timestamp == prev_timestamp) {
+ speed = GCLUE_LOCATION_SPEED_UNKNOWN;
+
+ goto out;
+ }
speed = geocode_location_get_distance_from (gloc, prev_gloc) *
1000.0 / (timestamp - prev_timestamp);