Format-Wide: Fix NullReferenceException (#15990)

This commit is contained in:
Daryl Graves 2021-08-25 17:45:00 +01:00 committed by GitHub
parent a4d14576b3
commit 321b726306
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -458,7 +458,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
}
sb.Append(GenerateRowField(values[k], _si.columnInfo[k].width, alignment[k], dc, addPadding));
if (values[k].Contains(ESC))
if (values[k] is not null && values[k].Contains(ESC))
{
// Reset the console output if the content of this column contains ESC
sb.Append(PSStyle.Instance.Reset);