diff --git a/src/map.js b/src/map.js index bf592a6d..d2750b26 100644 --- a/src/map.js +++ b/src/map.js @@ -631,11 +631,15 @@ jvm.Map.prototype = { if (jvm.$.isArray(keys)) { for (i = 0; i < keys.length; i++) { - this[type][keys[i]].element.setSelected(true); + if (this[type][keys[i]] != undefined) { + this[type][keys[i]].element.setSelected(true); + } } } else { for (i in keys) { - this[type][i].element.setSelected(!!keys[i]); + if (this[type][i] != undefined) { + this[type][i].element.setSelected(!!keys[i]); + } } } }, diff --git a/tests/unknown-region.html b/tests/unknown-region.html new file mode 100644 index 00000000..627bfac3 --- /dev/null +++ b/tests/unknown-region.html @@ -0,0 +1,61 @@ + + +
+ +
+ Selected: United States (US), Cocos Islands (CC), Australia (AU)
+ Non existent region: Cocos Islands (CC)
+