{"action":"opened","issue":{"url":"https://api.github.com/repos/d3/d3-brush/issues/15","repository_url":"https://api.github.com/repos/d3/d3-brush","labels_url":"https://api.github.com/repos/d3/d3-brush/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/d3/d3-brush/issues/15/comments","events_url":"https://api.github.com/repos/d3/d3-brush/issues/15/events","html_url":"https://github.com/d3/d3-brush/issues/15","id":174803150,"number":15,"title":"brush.move can cause obscure error","user":{"login":"mblandfo","id":8888671,"avatar_url":"https://avatars.githubusercontent.com/u/8888671?v=3","gravatar_id":"","url":"https://api.github.com/users/mblandfo","html_url":"https://github.com/mblandfo","followers_url":"https://api.github.com/users/mblandfo/followers","following_url":"https://api.github.com/users/mblandfo/following{/other_user}","gists_url":"https://api.github.com/users/mblandfo/gists{/gist_id}","starred_url":"https://api.github.com/users/mblandfo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mblandfo/subscriptions","organizations_url":"https://api.github.com/users/mblandfo/orgs","repos_url":"https://api.github.com/users/mblandfo/repos","events_url":"https://api.github.com/users/mblandfo/events{/privacy}","received_events_url":"https://api.github.com/users/mblandfo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-02T16:50:46Z","updated_at":"2016-09-02T16:50:46Z","closed_at":null,"body":"Reproduction is here: https://jsfiddle.net/sxrxaxrL/1/\r\n\r\nLines 76-81:\r\n\r\n```\r\n    if(x1 === x2){\r\n    \t//x2 = x1 + .1; // UNCOMMENT THIS TO FIX\r\n    }\r\n    var moveTo = [x(x1), x(x2)];\r\n    console.log('move to = ' + moveTo);\r\n    bg.call(brush.move, moveTo);   \r\n```\r\n\r\nCalling brush.move with x1 == x2 seems to work ok, but then in a d3 callback on a different call stack, it crashes:\r\n\r\nd3.v4.js:12809 Uncaught TypeError: Cannot read property '0' of null\r\n\r\nd3 source: (crash happens on the final line)\r\n\r\n```\r\n        selection = state.selection; // May be set by brush.move!\r\n\r\n        if (lockX) w1 = selection[0][0], e1 = selection[1][0];\r\n        if (lockY) n1 = selection[0][1], s1 = selection[1][1];\r\n\r\n        if (selection[0][0] !== w1\r\n```\r\n\r\nIf it's not allowed to call brush.move with x1 == x2, then at least it should throw an error immediately explaining this instead of later on a different call stack"}}
{"actor":{"display_login":"mblandfo"}}