diff --git a/js/id/renderer/features.js b/js/id/renderer/features.js index 9793025d4..75c6eac72 100644 --- a/js/id/renderer/features.js +++ b/js/id/renderer/features.js @@ -305,8 +305,10 @@ iD.Features = function(context) { var parents = features.getParents(entity, resolver, geometry); if (parents.length === 1) { var pkey = iD.Entity.key(parents[0]); - matches = _.clone(_cache[pkey].matches); - continue; + if (_cache[pkey] && _cache[pkey].matches) { + matches = _.clone(_cache[pkey].matches); + continue; + } } } } diff --git a/test/spec/renderer/features.js b/test/spec/renderer/features.js index 35a615f4e..01c2155af 100644 --- a/test/spec/renderer/features.js +++ b/test/spec/renderer/features.js @@ -135,6 +135,8 @@ describe('iD.Features', function() { iD.Way({id: 'scrub', tags: {area: 'yes', natural: 'scrub'}, version: 1}), iD.Way({id: 'industrial', tags: {area: 'yes', landuse: 'industrial'}, version: 1}), iD.Way({id: 'parkinglot', tags: {area: 'yes', amenity: 'parking', parking: 'surface'}, version: 1}), + + // Landuse with hole iD.Way({id: 'inner', version: 1}), iD.Way({id: 'outer', version: 1}), iD.Relation({id: 'retail', tags: {landuse: 'retail', type: 'multipolygon'}, @@ -175,7 +177,17 @@ describe('iD.Features', function() { // Others iD.Way({id: 'fence', tags: {barrier: 'fence'}, version: 1}), - iD.Way({id: 'pipeline', tags: {man_made: 'pipeline'}, version: 1}) + iD.Way({id: 'pipeline', tags: {man_made: 'pipeline'}, version: 1}), + + // Site relation + iD.Relation({id: 'site', tags: {type: 'site'}, + members: [ + {id: 'fence', role: 'perimeter'}, + {id: 'building_yes'} + ], + version: 1 + }), + ]), all = _.values(graph.base().entities);