summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@update.uu.se>2016-02-24 22:27:01 +0100
committerMarcus Lundblad <ml@update.uu.se>2016-02-26 07:35:53 +0100
commit757bafb4e0fc7114d24c499ee76db6222f3d4c78 (patch)
tree772c51caef667045b451c59fce3a58ce59c339e0
parent8b44264bc8e90fd268dfd0a513506affd2d32c26 (diff)
downloadgnome-maps-757bafb4e0fc7114d24c499ee76db6222f3d4c78.tar.gz
osmUtils: Don't update a place's name if not in the OSM object
When a place has been edited on OSM don't reset the Place's name attribute if it's not set in the OSM object, since the PlaceFormatter assumes this is set. For bare address nodes, this would be set to a value contructed from the address components, so we shouldn't remove this just because the OSM object doesn't have a name set. This fixes stack trace when saving places like that. https://bugzilla.gnome.org/show_bug.cgi?id=762569
-rw-r--r--src/osmUtils.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/osmUtils.js b/src/osmUtils.js
index 01235aa9..91c6b696 100644
--- a/src/osmUtils.js
+++ b/src/osmUtils.js
@@ -47,7 +47,15 @@ function getWikipediaOSMArticleFormatFromUrl(url) {
* Will also update place in the place store.
*/
function updatePlaceFromOSMObject(place, object) {
- place.name = object.get_tag('name');
+ let name = object.get_tag('name');
+
+ if (name) {
+ /* only update the place's name from the OSM object if the OSM object
+ * actually has a name set.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=762569
+ */
+ place.name = name;
+ }
place.population = object.get_tag('population');
place.website = object.get_tag('website');
place.phone = object.get_tag('phone');