Skip to content

Commit

Permalink
Merge pull request #40 from microsoft/jschick/fix_description_indexerror
Browse files Browse the repository at this point in the history
Added property count check in FormatDescription to prevent IndexOutOfRange error
  • Loading branch information
bill-long authored May 16, 2023
2 parents e9991a2 + b247bba commit c0a807b
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ protected EventResolverBase(Action<string> tracer)

sb.Append(description.AsSpan(lastIndex, matches[i].Index - lastIndex));
var propIndex = int.Parse(matches[i].Value.Trim(new[] { '{', '}', '%' }));

if (propIndex - 1 >= eventRecord.Properties.Count) { return "Unable to format description"; }

var propValue = eventRecord.Properties[propIndex - 1].Value;
if (propValue is DateTime)
{
Expand Down

0 comments on commit c0a807b

Please sign in to comment.