Keep argument checks

This commit is contained in:
Sebastien Ros 2019-02-26 17:15:23 -08:00
parent ba875bffcd
commit 23dee7c43f
1 changed files with 15 additions and 0 deletions

View File

@ -64,6 +64,21 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
public override void Encode(TextWriter output, string value, int startIndex, int characterCount)
{
if (output == null)
{
throw new ArgumentNullException(nameof(output));
}
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
if (characterCount == 0)
{
return;
}
var span = value.AsSpan();
output.Write(span.Slice(startIndex, characterCount));
}