Skip to content

Commit

Permalink
IndexOf(…, count, …) enforces length
Browse files Browse the repository at this point in the history
  • Loading branch information
AliveDevil committed Aug 26, 2024
1 parent 01fed7e commit fcb621b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ string Message
// Skip these:
// - StdErr is mapped to Information
// - StdOut is mapped to Debug.
if (@event.Message.Length > 0 && @event.Message[0] is char first
if (@event.Message.Length is { } messageLength and > 0
&& @event.Message[0] is char first
&& !char.IsWhiteSpace(first)
&& @event.Message.IndexOf(": ", 0, 18) is { } firstColon and not -1)
&& @event.Message.IndexOf(": ", 0, Math.Min(messageLength, 18)) is { } firstColon and not -1)
{
structuredLog.Message = @event.Message.Substring(firstColon + 2);

Expand Down

0 comments on commit fcb621b

Please sign in to comment.