{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/Cognitive-LUIS-Windows/issues/11","repository_url":"https://api.github.com/repos/Microsoft/Cognitive-LUIS-Windows","labels_url":"https://api.github.com/repos/Microsoft/Cognitive-LUIS-Windows/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/Cognitive-LUIS-Windows/issues/11/comments","events_url":"https://api.github.com/repos/Microsoft/Cognitive-LUIS-Windows/issues/11/events","html_url":"https://github.com/Microsoft/Cognitive-LUIS-Windows/issues/11","id":178246239,"number":11,"title":"Null Reference Exception if result[\"topScoringIntent\"] doesn't exist","user":{"login":"ChuckkNorris","id":7637401,"avatar_url":"https://avatars.githubusercontent.com/u/7637401?v=3","gravatar_id":"","url":"https://api.github.com/users/ChuckkNorris","html_url":"https://github.com/ChuckkNorris","followers_url":"https://api.github.com/users/ChuckkNorris/followers","following_url":"https://api.github.com/users/ChuckkNorris/following{/other_user}","gists_url":"https://api.github.com/users/ChuckkNorris/gists{/gist_id}","starred_url":"https://api.github.com/users/ChuckkNorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChuckkNorris/subscriptions","organizations_url":"https://api.github.com/users/ChuckkNorris/orgs","repos_url":"https://api.github.com/users/ChuckkNorris/repos","events_url":"https://api.github.com/users/ChuckkNorris/events{/privacy}","received_events_url":"https://api.github.com/users/ChuckkNorris/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-21T04:55:44Z","updated_at":"2016-10-27T13:10:58Z","closed_at":"2016-10-27T13:10:58Z","body":"In `LuisResult.Load()`, if `JToken result[\"topScoringIntent\"]` does not exist (which it did not in my case - not sure why), `Intent.Load()` will throw a null reference exception.\r\n\r\n`LuisResult.Load()` requires a null check of the `topScoringIntent`:\r\n```\r\nif (Intents.Length == 0)\r\n{\r\n    JObject topScoringIntent = (JObject)result[\"topScoringIntent\"];\r\n    if (topScoringIntent != null) {\r\n        var t = new Intent();\r\n        t.Load(topScoringIntent);\r\n        TopScoringIntent = t;\r\n        Intents = new Intent[1];\r\n        Intents[0] = TopScoringIntent;\r\n    }\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"Ahmkel"}}