Skip to content

Commit 32632f9

Browse files
gomoripetimergify[bot]
authored andcommitted
Handle type state being undefined for very old queues
Field #amqqueue.type_state can be undefined for queues declared on old RabbitMQ versions before 3.8.0. Ensure `amqqueue:get_type_state/1` always returns a map according to its type spec to make life of calling code easier. (cherry picked from commit cc95d37)
1 parent 73380d9 commit 32632f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

deps/rabbit/src/amqqueue.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ set_policy_version(#amqqueue{} = Queue, PV) ->
470470
% type_state (new in v2)
471471

472472
-spec get_type_state(amqqueue()) -> map().
473-
get_type_state(#amqqueue{type_state = TState}) ->
473+
get_type_state(#amqqueue{type_state = TState}) when is_map(TState) ->
474474
TState;
475475
get_type_state(_) ->
476476
#{}.

0 commit comments

Comments
 (0)