octokit.net
octokit.net copied to clipboard
Construction of ReadOnlyCollection in RepositoriesClient.GetAllLanguages() method can throw null argument exception
see here: https://github.com/octokit/octokit.net/blob/master/Octokit/Clients/RepositoriesClient.cs#L792
If this method is called and the API does not return a value, a null argument exception is thrown by the ReadOnlyCollection constructor.
example repo: vhf/free-programming-books (id: 13491895)
Note: I'd like to contribute by opening a PR for this issue. I first need to investigate how "empty" results from the API are handled by other methods.
This seems plausible according to the reference source, but I'm not sure why this code shouldn't return an empty enumerable when there are no values in the response:
data.Select(kvp => new RepositoryLanguage(kvp.Key, kvp.Value)).ToList()
I'll need to double check. I believe that was the exception and stack trace I was seeing, but I agree that the .ToList() should not return null.
👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!