From 6a2c9c80a50a181f87fecd716e7b02614137d491 Mon Sep 17 00:00:00 2001 From: Daryl Graves <46203429+DarylGraves@users.noreply.github.com> Date: Wed, 25 Aug 2021 17:45:00 +0100 Subject: [PATCH] Format-Wide: Fix NullReferenceException (#15990) --- .../FormatAndOutput/common/TableWriter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs b/src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs index 74d5f543e0..fb5ef0bf93 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs @@ -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);