Skip to content

Commit

Permalink
Make sure we have the properties before trying to use them. References
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon MacMullen committed Mar 13, 2015
1 parent be901c1 commit 2699e48
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/rabbit_priority_queue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,12 @@ a(State = #state{bqss = BQSs}) ->

priority(P, BQSs) when is_integer(P) ->
{P, bq_fetch(P, BQSs)};
priority(_Msg, [{P, BQSN}]) ->
priority(#basic_message{content = Content}, BQSs) ->
priority1(rabbit_binary_parser:ensure_content_decoded(Content), BQSs).

priority1(_Content, [{P, BQSN}]) ->
{P, BQSN};
priority(Msg = #basic_message{content = #content{properties = Props}},
priority1(Content = #content{properties = Props},
[{P, BQSN} | Rest]) ->
#'P_basic'{priority = Priority0} = Props,
Priority = case Priority0 of
Expand All @@ -544,7 +547,7 @@ priority(Msg = #basic_message{content = #content{properties = Props}},
end,
case Priority >= P of
true -> {P, BQSN};
false -> priority(Msg, Rest)
false -> priority1(Content, Rest)
end.

add_maybe_infinity(infinity, _) -> infinity;
Expand Down

0 comments on commit 2699e48

Please sign in to comment.