diff options
author | Marcus Lundblad <ml@update.uu.se> | 2016-02-24 22:27:01 +0100 |
---|---|---|
committer | Marcus Lundblad <ml@update.uu.se> | 2016-02-26 07:35:53 +0100 |
commit | 757bafb4e0fc7114d24c499ee76db6222f3d4c78 (patch) | |
tree | 772c51caef667045b451c59fce3a58ce59c339e0 | |
parent | 8b44264bc8e90fd268dfd0a513506affd2d32c26 (diff) | |
download | gnome-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.js | 10 |
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'); |