Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ private string GenerateRow(string[] values, ReadOnlySpan<int> alignment, Display
}

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))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (values[k] is not null && values[k].Contains(ESC))
if (values[k]?.Contains(ESC))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (values[k]?.Contains(ESC))

It is not work (can return null but bool is expected..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need to do anything here? Sorry, a bit new to this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, you're fine. I misremembered how these operators work a little bit.

{
// Reset the console output if the content of this column contains ESC
sb.Append(PSStyle.Instance.Reset);
Expand Down