{"action":"closed","issue":{"url":"https://api.github.com/repos/Famous/famous/issues/496","labels_url":"https://api.github.com/repos/Famous/famous/issues/496/labels{/name}","comments_url":"https://api.github.com/repos/Famous/famous/issues/496/comments","events_url":"https://api.github.com/repos/Famous/famous/issues/496/events","html_url":"https://github.com/Famous/famous/issues/496","id":50216991,"number":496,"title":"Using ViewSequence.splice after ViewSequence.unshift raises exception","user":{"login":"IjzerenHein","id":6184593,"avatar_url":"https://avatars.githubusercontent.com/u/6184593?v=3","gravatar_id":"","url":"https://api.github.com/users/IjzerenHein","html_url":"https://github.com/IjzerenHein","followers_url":"https://api.github.com/users/IjzerenHein/followers","following_url":"https://api.github.com/users/IjzerenHein/following{/other_user}","gists_url":"https://api.github.com/users/IjzerenHein/gists{/gist_id}","starred_url":"https://api.github.com/users/IjzerenHein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IjzerenHein/subscriptions","organizations_url":"https://api.github.com/users/IjzerenHein/orgs","repos_url":"https://api.github.com/users/IjzerenHein/repos","events_url":"https://api.github.com/users/IjzerenHein/events{/privacy}","received_events_url":"https://api.github.com/users/IjzerenHein/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Famous/famous/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-11-26T19:17:45Z","updated_at":"2015-05-22T08:54:30Z","closed_at":"2015-05-22T08:54:30Z","body":"The following code causes an exception on the splice call:\r\n\r\n```javascript\r\nvar viewSequence = new ViewSequence();\r\nviewSequence.unshift(new Surface()); // insert 1 item\r\nviewSequence.unshift(new Surface()); // insert 2 item\r\nviewSequence.splice(1, 0, new Surface()); // insert item in between\r\n```\r\n\r\nLooking at the code it seems to be something with `_.firstIndex`. When you use unshift it sets that variable, and .splice uses, but it seems to result in an invalid array-index.\r\nI don't understand how the code is intended, so I couldn't fix it myself.\r\n"}}