{"action":"opened","issue":{"url":"https://api.github.com/repos/MidEndProject/node-pdf2img/issues/6","repository_url":"https://api.github.com/repos/MidEndProject/node-pdf2img","labels_url":"https://api.github.com/repos/MidEndProject/node-pdf2img/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/MidEndProject/node-pdf2img/issues/6/comments","events_url":"https://api.github.com/repos/MidEndProject/node-pdf2img/issues/6/events","html_url":"https://github.com/MidEndProject/node-pdf2img/issues/6","id":132408833,"number":6,"title":"Cannot set property 'page' of null","user":{"login":"proreact-mj","id":13857623,"avatar_url":"https://avatars.githubusercontent.com/u/13857623?v=3","gravatar_id":"","url":"https://api.github.com/users/proreact-mj","html_url":"https://github.com/proreact-mj","followers_url":"https://api.github.com/users/proreact-mj/followers","following_url":"https://api.github.com/users/proreact-mj/following{/other_user}","gists_url":"https://api.github.com/users/proreact-mj/gists{/gist_id}","starred_url":"https://api.github.com/users/proreact-mj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/proreact-mj/subscriptions","organizations_url":"https://api.github.com/users/proreact-mj/orgs","repos_url":"https://api.github.com/users/proreact-mj/repos","events_url":"https://api.github.com/users/proreact-mj/events{/privacy}","received_events_url":"https://api.github.com/users/proreact-mj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-09T12:33:53Z","updated_at":"2016-02-09T12:33:53Z","closed_at":null,"body":"I have found a files that fails conversion\r\n\r\n```\r\nTypeError: Cannot set property 'page' of null\r\n    at /[app_path]/node_modules/pdf2img/lib/pdf2img.js:66:23\r\n```\r\n\r\nIf I echo out error right after convertPdf2Img has execute it show that the \"datasize < 127\" check fails, thus passing an error back, but the error is unhandled and crashes the server.\r\n\r\nSuggest wrapping the lines\r\n```\r\n          result.page = page;\r\n          callbackmap(null, result);\r\n```\r\nas\r\n```\r\nif (error) console.log(error); //or some other error handling\r\nelse { \r\n  result.page = page;\r\n  callbackmap(null, result);\r\n}\r\n```\r\nThis seems to work for my file in question (basic document converted from Word, attached\r\n[1455011779_56191.pdf](https://github.com/MidEndProject/node-pdf2img/files/123052/1455011779_56191.pdf)\r\n) and it correctly returns the 3 pages. \r\n\r\nI'm not sure if the skipped callbackmap can cause other problems. And there is probably a better way of doing it. **But I guess it would be the same behavior (server crash) for every error passed from convertPdf2Img.**\r\n\r\nPointers as to what is wrong with the file are also welcome :)"}}