{"action":"closed","issue":{"url":"https://api.github.com/repos/SoftwareEngineeringProjectCEIE/SourceCode/issues/3","labels_url":"https://api.github.com/repos/SoftwareEngineeringProjectCEIE/SourceCode/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/SoftwareEngineeringProjectCEIE/SourceCode/issues/3/comments","events_url":"https://api.github.com/repos/SoftwareEngineeringProjectCEIE/SourceCode/issues/3/events","html_url":"https://github.com/SoftwareEngineeringProjectCEIE/SourceCode/issues/3","id":118853789,"number":3,"title":"Load... methods can return null value","user":{"login":"gabr","id":1800038,"avatar_url":"https://avatars.githubusercontent.com/u/1800038?v=3","gravatar_id":"","url":"https://api.github.com/users/gabr","html_url":"https://github.com/gabr","followers_url":"https://api.github.com/users/gabr/followers","following_url":"https://api.github.com/users/gabr/following{/other_user}","gists_url":"https://api.github.com/users/gabr/gists{/gist_id}","starred_url":"https://api.github.com/users/gabr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabr/subscriptions","organizations_url":"https://api.github.com/users/gabr/orgs","repos_url":"https://api.github.com/users/gabr/repos","events_url":"https://api.github.com/users/gabr/events{/privacy}","received_events_url":"https://api.github.com/users/gabr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SoftwareEngineeringProjectCEIE/SourceCode/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/SoftwareEngineeringProjectCEIE/SourceCode/labels/To%20Review","name":"To Review","color":"fbca04"}],"state":"closed","locked":false,"assignee":{"login":"rysiacz","id":15088938,"avatar_url":"https://avatars.githubusercontent.com/u/15088938?v=3","gravatar_id":"","url":"https://api.github.com/users/rysiacz","html_url":"https://github.com/rysiacz","followers_url":"https://api.github.com/users/rysiacz/followers","following_url":"https://api.github.com/users/rysiacz/following{/other_user}","gists_url":"https://api.github.com/users/rysiacz/gists{/gist_id}","starred_url":"https://api.github.com/users/rysiacz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rysiacz/subscriptions","organizations_url":"https://api.github.com/users/rysiacz/orgs","repos_url":"https://api.github.com/users/rysiacz/repos","events_url":"https://api.github.com/users/rysiacz/events{/privacy}","received_events_url":"https://api.github.com/users/rysiacz/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/SoftwareEngineeringProjectCEIE/SourceCode/milestones/1","html_url":"https://github.com/SoftwareEngineeringProjectCEIE/SourceCode/milestones/Wreak%20havoc","labels_url":"https://api.github.com/repos/SoftwareEngineeringProjectCEIE/SourceCode/milestones/1/labels","id":1432081,"number":1,"title":"Wreak havoc","description":"Our first milestone!","creator":{"login":"przezor","id":6940223,"avatar_url":"https://avatars.githubusercontent.com/u/6940223?v=3","gravatar_id":"","url":"https://api.github.com/users/przezor","html_url":"https://github.com/przezor","followers_url":"https://api.github.com/users/przezor/followers","following_url":"https://api.github.com/users/przezor/following{/other_user}","gists_url":"https://api.github.com/users/przezor/gists{/gist_id}","starred_url":"https://api.github.com/users/przezor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/przezor/subscriptions","organizations_url":"https://api.github.com/users/przezor/orgs","repos_url":"https://api.github.com/users/przezor/repos","events_url":"https://api.github.com/users/przezor/events{/privacy}","received_events_url":"https://api.github.com/users/przezor/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":1,"state":"open","created_at":"2015-11-27T08:20:09Z","updated_at":"2015-12-13T10:25:16Z","due_on":"2015-12-10T23:00:00Z","closed_at":null},"comments":4,"created_at":"2015-11-25T14:57:50Z","updated_at":"2015-12-13T10:25:16Z","closed_at":"2015-12-13T10:25:16Z","body":"There are three **Load** methods in **DataBase.cs** file.\r\nIn some cases they may return null value.\r\n\r\nThis behavior causes NullPointExceptions in other parts of the project.\r\nBut instead of providing null checks we can **Null Object** design patter.\r\n\r\nIn other words. Instead of:\r\n\r\n    if (result != null) { ... }\r\n\r\nthose methods should return empty lists.\r\nI assign @rysiacz to this task.\r\n\r\nExample for you:\r\n\r\n    public List<object> LoadObjects()\r\n    {\r\n        List<object> result = new List<object>();\r\n        // some actions\r\n        if (error)\r\n        {\r\n            return null;\r\n        }\r\n        else\r\n        {\r\n            return result;\r\n        }\r\n    }\r\n\r\nSuch code should be changed into:\r\n\r\n    public List<object> LoadObjects()\r\n    {\r\n        List<object> result = new List<object>();\r\n        // some actions\r\n        if (error)\r\n        {\r\n            return new List<object>();\r\n        }\r\n        else\r\n        {\r\n            return result;\r\n        }\r\n    }\r\n\r\nTry to hunt down all such cases.\r\nYou have three such methods inside **DataBase.cs** file for sure, but look for it in other files as well.\r\n\r\nRemember to compile project before commiting the result."}}