{"action":"created","issue":{"url":"https://api.github.com/repos/DavidDurman/joint/issues/111","labels_url":"https://api.github.com/repos/DavidDurman/joint/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/DavidDurman/joint/issues/111/comments","events_url":"https://api.github.com/repos/DavidDurman/joint/issues/111/events","html_url":"https://github.com/DavidDurman/joint/issues/111","id":55895621,"number":111,"title":"Issue in joint.util.getByPath()","user":{"login":"JoseGoncalves","id":3037740,"avatar_url":"https://avatars.githubusercontent.com/u/3037740?v=3","gravatar_id":"","url":"https://api.github.com/users/JoseGoncalves","html_url":"https://github.com/JoseGoncalves","followers_url":"https://api.github.com/users/JoseGoncalves/followers","following_url":"https://api.github.com/users/JoseGoncalves/following{/other_user}","gists_url":"https://api.github.com/users/JoseGoncalves/gists{/gist_id}","starred_url":"https://api.github.com/users/JoseGoncalves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoseGoncalves/subscriptions","organizations_url":"https://api.github.com/users/JoseGoncalves/orgs","repos_url":"https://api.github.com/users/JoseGoncalves/repos","events_url":"https://api.github.com/users/JoseGoncalves/events{/privacy}","received_events_url":"https://api.github.com/users/JoseGoncalves/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-01-29T12:57:47Z","updated_at":"2015-02-02T15:25:43Z","closed_at":"2015-02-02T15:25:43Z","body":"I found a situation were I got the following error in joint.util.getByPath();\r\n\r\n>Uncaught TypeError: Cannot use 'in' operator to search for 'input' in null\r\n\r\nThis can be solved by checking if `obj` is valid in the `keys` loop like this;\r\n\r\n```javascript\r\n            while (keys.length) {\r\n                key = keys.shift();\r\n                if (obj) {\r\n                   if (key in obj) {\r\n                        obj = obj[key];\r\n                    } else {\r\n                        return undefined;\r\n                    }\r\n                }\r\n            }\r\n```"},"comment":{"url":"https://api.github.com/repos/DavidDurman/joint/issues/comments/72475225","html_url":"https://github.com/DavidDurman/joint/issues/111#issuecomment-72475225","issue_url":"https://api.github.com/repos/DavidDurman/joint/issues/111","id":72475225,"user":{"login":"kumilingus","id":3967880,"avatar_url":"https://avatars.githubusercontent.com/u/3967880?v=3","gravatar_id":"","url":"https://api.github.com/users/kumilingus","html_url":"https://github.com/kumilingus","followers_url":"https://api.github.com/users/kumilingus/followers","following_url":"https://api.github.com/users/kumilingus/following{/other_user}","gists_url":"https://api.github.com/users/kumilingus/gists{/gist_id}","starred_url":"https://api.github.com/users/kumilingus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumilingus/subscriptions","organizations_url":"https://api.github.com/users/kumilingus/orgs","repos_url":"https://api.github.com/users/kumilingus/repos","events_url":"https://api.github.com/users/kumilingus/events{/privacy}","received_events_url":"https://api.github.com/users/kumilingus/received_events","type":"User","site_admin":false},"created_at":"2015-02-02T15:25:43Z","updated_at":"2015-02-02T15:25:43Z","body":"Thanks. I can't reproduce what you've described. The first item of the array built by Inspector is always an object.\r\n````\r\n{ input: '', operation: 'GroupBy', output: ''}\r\n````\r\nHowever I noticed that if I set `config` attribute manually to `[null]` this error occurs.\r\nIt's been fixed as you proposed with a tiny difference.\r\n````\r\n            while (keys.length) {\r\n                key = keys.shift();\r\n                if (Object(obj) === obj && key in obj) {\r\n                    obj = obj[key];\r\n                } else {\r\n                    return undefined;\r\n                }\r\n             }\r\n````\r\nWe don't want `joint.util.getByPath([null], '0.property')` to return `null` but `undefined` instead (similar to `joint.util.getByPath([], '0.property')`).\r\n`joint.util.getByPath([5], '0.property')` also threw an error. That's why we are checking if `obj` is an object (`Object(a) ===  a`).\r\n\r\nCheers!\r\n\r\n"}}