From 191c7002f4d9dad506a985db59eae82aa7bd0da4 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Thu, 22 May 2014 16:20:52 -0400 Subject: [PATCH] Handle empty selectedIDs.. --- js/id/ui/preset/check.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/id/ui/preset/check.js b/js/id/ui/preset/check.js index d7159d29f..56cd2a69b 100644 --- a/js/id/ui/preset/check.js +++ b/js/id/ui/preset/check.js @@ -22,8 +22,9 @@ iD.ui.preset.defaultcheck = function(field, context) { // hack: pretend oneway field is a oneway_yes field if `junction=roundabout` is set. if (field.id === 'oneway') { - var way = context.entity(context.selectedIDs()[0]); - if (way.tags.junction === 'roundabout') { + var ids = context.selectedIDs(), + way = ids.length && context.entity(ids[0]); + if (way && way.tags.junction === 'roundabout') { texts.shift(); texts.unshift(t('presets.fields.oneway_yes.check.undefined', { 'default': 'Assumed to be Yes' })); }