Skip to content

Commit

Permalink
Don't create list unless needed
Browse files Browse the repository at this point in the history
Co-authored-by: Liudmila Molkova <limolkova@microsoft.com>
  • Loading branch information
meum and lmolkova authored Jan 31, 2025
1 parent a3d9c1c commit 9b63236
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion projects/RabbitMQ.Client/Impl/RabbitMQActivitySource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ public static bool UseRoutingKeyAsOperationName
private static Activity? StartLinkedRabbitMQActivity(this ActivitySource source, string name, ActivityKind kind,
ActivityContext linkedContext = default, ActivityContext parentContext = default)
{
var links = new List<ActivityLink>();
List<ActivityLink> links = null;

Check warning on line 175 in projects/RabbitMQ.Client/Impl/RabbitMQActivitySource.cs

View workflow job for this annotation

GitHub Actions / oauth2-uaa

Converting null literal or possible null value to non-nullable type.

Check warning on line 175 in projects/RabbitMQ.Client/Impl/RabbitMQActivitySource.cs

View workflow job for this annotation

GitHub Actions / oauth2-keycloak

Converting null literal or possible null value to non-nullable type.
if (linkedContext != default)
{
links = new List<ActivityLink>();
links.Add(new ActivityLink(linkedContext));
}
return source.CreateActivity(name, kind, parentContext: parentContext,
Expand Down

0 comments on commit 9b63236

Please sign in to comment.