{"action":"created","issue":{"url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/2336","labels_url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/2336/labels{/name}","comments_url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/2336/comments","events_url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/2336/events","html_url":"https://github.com/greasemonkey/greasemonkey/issues/2336","id":116980458,"number":2336,"title":"Invalid metadata in \"New script template\" prevents creation of new scripts","user":{"login":"NoneGiven","id":2163967,"avatar_url":"https://avatars.githubusercontent.com/u/2163967?v=3","gravatar_id":"","url":"https://api.github.com/users/NoneGiven","html_url":"https://github.com/NoneGiven","followers_url":"https://api.github.com/users/NoneGiven/followers","following_url":"https://api.github.com/users/NoneGiven/following{/other_user}","gists_url":"https://api.github.com/users/NoneGiven/gists{/gist_id}","starred_url":"https://api.github.com/users/NoneGiven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NoneGiven/subscriptions","organizations_url":"https://api.github.com/users/NoneGiven/orgs","repos_url":"https://api.github.com/users/NoneGiven/repos","events_url":"https://api.github.com/users/NoneGiven/events{/privacy}","received_events_url":"https://api.github.com/users/NoneGiven/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/greasemonkey/greasemonkey/milestones/69","html_url":"https://github.com/greasemonkey/greasemonkey/milestones/3.7","labels_url":"https://api.github.com/repos/greasemonkey/greasemonkey/milestones/69/labels","id":1372601,"number":69,"title":"3.7","description":"","creator":{"login":"arantius","id":84729,"avatar_url":"https://avatars.githubusercontent.com/u/84729?v=3","gravatar_id":"","url":"https://api.github.com/users/arantius","html_url":"https://github.com/arantius","followers_url":"https://api.github.com/users/arantius/followers","following_url":"https://api.github.com/users/arantius/following{/other_user}","gists_url":"https://api.github.com/users/arantius/gists{/gist_id}","starred_url":"https://api.github.com/users/arantius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arantius/subscriptions","organizations_url":"https://api.github.com/users/arantius/orgs","repos_url":"https://api.github.com/users/arantius/repos","events_url":"https://api.github.com/users/arantius/events{/privacy}","received_events_url":"https://api.github.com/users/arantius/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":4,"state":"open","created_at":"2015-10-23T15:23:09Z","updated_at":"2016-01-21T14:20:04Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2015-11-15T08:25:44Z","updated_at":"2016-01-25T04:34:11Z","closed_at":"2016-01-20T21:12:36Z","body":"I ran into this issue because mysteriously, months after I last touched this setting, the newlines in my custom template were lost/replaced.\r\n\r\nTo reproduce, put some random junk in \"New script template\" in Greasemonkey's options panel, go to add a new script, and click the Okay button to add it. Observe the null reference exception in the console and the lack of a new script being added.\r\n\r\nThe variable `meta` in `parseScript.js::parse()` coming from `extractMeta.js::extractMeta()` is null after attempting to extract invalid metadata (even though `extractMeta()` is clearly supposed to return an empty string if the regex doesn't match). There are a couple of \"if not meta\" lines in `parse()` that look like they should fall back on defaults for a null/empty metadata string, but apparently `aNoMetaOk` is true so it keeps going until the null reference.\r\n\r\nI would have submitted a PR but I'm not sure what exactly `aNoMetaOk`'s purpose in life is and what changes are okay there."},"comment":{"url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/comments/174397075","html_url":"https://github.com/greasemonkey/greasemonkey/issues/2336#issuecomment-174397075","issue_url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/2336","id":174397075,"user":{"login":"NoneGiven","id":2163967,"avatar_url":"https://avatars.githubusercontent.com/u/2163967?v=3","gravatar_id":"","url":"https://api.github.com/users/NoneGiven","html_url":"https://github.com/NoneGiven","followers_url":"https://api.github.com/users/NoneGiven/followers","following_url":"https://api.github.com/users/NoneGiven/following{/other_user}","gists_url":"https://api.github.com/users/NoneGiven/gists{/gist_id}","starred_url":"https://api.github.com/users/NoneGiven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NoneGiven/subscriptions","organizations_url":"https://api.github.com/users/NoneGiven/orgs","repos_url":"https://api.github.com/users/NoneGiven/repos","events_url":"https://api.github.com/users/NoneGiven/events{/privacy}","received_events_url":"https://api.github.com/users/NoneGiven/received_events","type":"User","site_admin":false},"created_at":"2016-01-25T04:34:11Z","updated_at":"2016-01-25T04:34:11Z","body":"Thanks, I guess it was just the direct link it didn't like. Can confirm this issue is fixed."}}