Skip to content

Commit 1d8737c

Browse files
committed
Address gemini code review comments
Signed-off-by: Kyle Julian <[email protected]>
1 parent 4b27e98 commit 1d8737c

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/OpenFeature.Contrib.Providers.Flagd/Resolver/Rpc/RpcResolver.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,9 @@ private FeatureProviderException GetOFException(RpcException e)
459459
#nullable enable
460460
private static ImmutableMetadata? BuildFlagMetadata(Struct? metadata)
461461
{
462-
if (metadata == null || metadata.Fields.Count == 0)
463-
{
464-
return null;
465-
}
466-
467462
var items = new Dictionary<string, object>();
468463

469-
foreach (var entry in metadata.Fields)
464+
foreach (var entry in metadata?.Fields ?? [])
470465
{
471466
switch (entry.Value.KindCase)
472467
{
@@ -490,7 +485,7 @@ private FeatureProviderException GetOFException(RpcException e)
490485
}
491486
}
492487

493-
return new ImmutableMetadata(items);
488+
return items.Count > 0 ? new ImmutableMetadata(items) : null;
494489
}
495490
#nullable disable
496491

0 commit comments

Comments
 (0)