summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Danielsson <jonas@threetimestwo.org>2015-09-08 13:20:43 +0200
committerJonas Danielsson <jonas@threetimestwo.org>2015-09-08 13:21:05 +0200
commitab14a536cbac5189dac51b227d8862dafba9ad00 (patch)
treea0510a61fd67889a13e411d258884371c3f527a5
parent873133f929aec17a429a1002b7d356e1c0de176f (diff)
downloadgnome-maps-ab14a536cbac5189dac51b227d8862dafba9ad00.tar.gz
Do not store routes with coordinate members
-rw-r--r--src/sidebar.js7
-rw-r--r--src/storedRoute.js12
2 files changed, 16 insertions, 3 deletions
diff --git a/src/sidebar.js b/src/sidebar.js
index 7496b225..79fb75fe 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -213,9 +213,10 @@ const Sidebar = new Lang.Class({
places: places
});
- placeStore.addPlace(storedRoute,
- PlaceStore.PlaceType.RECENT_ROUTE);
-
+ if (!storedRoute.containsNull) {
+ placeStore.addPlace(storedRoute,
+ PlaceStore.PlaceType.RECENT_ROUTE);
+ }
this._storeRouteTimeoutId = 0;
}).bind(this));
diff --git a/src/storedRoute.js b/src/storedRoute.js
index 16f761d3..05e56de5 100644
--- a/src/storedRoute.js
+++ b/src/storedRoute.js
@@ -102,6 +102,18 @@ const StoredRoute = new Lang.Class({
return this._containsCurrentLocation;
},
+ get containsNull() {
+ let hasNull = false;
+
+ for (let p = 0; p < this.places.length; p++) {
+ if (!this.places[p].name) {
+ hasNull = true;
+ break;
+ }
+ }
+ return hasNull;
+ },
+
toJSON: function() {
let turnPoints = this.route.turnPoints.map(function(turnPoint) {
let coordinate = { latitude: turnPoint.coordinate.latitude,