Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Remove double null check from 'MediaTypeCollection .Add' #5834

Closed
janosjanka opened this issue Feb 21, 2017 · 2 comments
Closed

Remove double null check from 'MediaTypeCollection .Add' #5834

janosjanka opened this issue Feb 21, 2017 · 2 comments
Assignees
Labels
3 - Done up-for-grabs Members of our awesome commnity can handle this issue

Comments

@janosjanka
Copy link

janosjanka commented Feb 21, 2017

public void Add(MediaTypeHeaderValue item)
{
    if (item == null)
    {
        throw new ArgumentNullException(nameof(item));
    }

    Add(item?.ToString()); // <= At this point, we already know that item cannot be null.
}

https://github.com/aspnet/Mvc/blob/master/src/Microsoft.AspNetCore.Mvc.Core/Formatters/MediaTypeCollection.cs#L33

@Eilon Eilon added 1 - Ready up-for-grabs Members of our awesome commnity can handle this issue labels Feb 21, 2017
@Eilon Eilon added this to the 2.0.0 milestone Feb 21, 2017
dougbu pushed a commit that referenced this issue Feb 28, 2017
@dougbu
Copy link
Member

dougbu commented Feb 28, 2017

0e914e5

@dougbu dougbu closed this as completed Feb 28, 2017
@dougbu dougbu added 3 - Done and removed 1 - Ready labels Feb 28, 2017
@dougbu
Copy link
Member

dougbu commented Feb 28, 2017

Thanks very much @reaction1989!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 - Done up-for-grabs Members of our awesome commnity can handle this issue
Projects
None yet
Development

No branches or pull requests

3 participants