Skip to content

Commit b199718

Browse files
committed
Address GHA test flakes
* Start by addressing a potential `NullReferenceException`
1 parent b1c3a58 commit b199718

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

RabbitMQ.AMQP.Client/Impl/AmqpQueueSpecification.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@ internal DefaultQueueInfo(string queueName)
3535

3636
internal DefaultQueueInfo(Map response)
3737
{
38-
_name = (string)response["name"];
38+
if (response["name"] is string name)
39+
{
40+
_name = name;
41+
}
42+
else
43+
{
44+
// TODO error?
45+
_name = string.Empty;
46+
}
47+
3948
_durable = (bool)response["durable"];
4049
_autoDelete = (bool)response["auto_delete"];
4150
_exclusive = (bool)response["exclusive"];
@@ -48,10 +57,12 @@ internal DefaultQueueInfo(Map response)
4857

4958
_leader = (string)response["leader"];
5059

51-
string[]? replicas = (string[])response["replicas"];
52-
if (replicas.Length > 0)
60+
if (response["replicas"] is string[] queueReplicas)
5361
{
54-
_replicas.AddRange(replicas);
62+
if (queueReplicas.Length > 0)
63+
{
64+
_replicas.AddRange(queueReplicas);
65+
}
5566
}
5667

5768
_messageCount = (ulong)response["message_count"];

0 commit comments

Comments
 (0)