{"action":"opened","issue":{"url":"https://api.github.com/repos/bem/bem-components/issues/1457","labels_url":"https://api.github.com/repos/bem/bem-components/issues/1457/labels{/name}","comments_url":"https://api.github.com/repos/bem/bem-components/issues/1457/comments","events_url":"https://api.github.com/repos/bem/bem-components/issues/1457/events","html_url":"https://github.com/bem/bem-components/issues/1457","id":67664473,"number":1457,"title":"select: Error in case of empty items array","user":{"login":"tormozz48","id":996162,"avatar_url":"https://avatars.githubusercontent.com/u/996162?v=3","gravatar_id":"","url":"https://api.github.com/users/tormozz48","html_url":"https://github.com/tormozz48","followers_url":"https://api.github.com/users/tormozz48/followers","following_url":"https://api.github.com/users/tormozz48/following{/other_user}","gists_url":"https://api.github.com/users/tormozz48/gists{/gist_id}","starred_url":"https://api.github.com/users/tormozz48/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tormozz48/subscriptions","organizations_url":"https://api.github.com/users/tormozz48/orgs","repos_url":"https://api.github.com/users/tormozz48/repos","events_url":"https://api.github.com/users/tormozz48/events{/privacy}","received_events_url":"https://api.github.com/users/tormozz48/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bem/bem-components/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/bem/bem-components/labels/JS","name":"JS","color":"006b75"},{"url":"https://api.github.com/repos/bem/bem-components/labels/v2","name":"v2","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-10T19:25:44Z","updated_at":"2015-04-10T19:25:44Z","closed_at":null,"body":"Hello all. I found some strange code in select block which gives me error in case of empty select item array on select initialization.\r\n\r\n_hoverCheckedOrFirstItem : function() { // NOTE: may be it should be moved to menu\r\n        (this._getCheckedItems()[0] || this._menu.getItems()[0])\r\n            .setMod('hovered');\r\n    },\r\n\r\nIt is simple to understand that in case of empty array this._menu.getItems()[0] will gives error with message: 'Uncaught TypeError: Cannot read property 'setMod' of undefined'"}}