Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Don't crash for clients without a last will
Browse files Browse the repository at this point in the history
References #74
  • Loading branch information
acogoluegnes committed Dec 7, 2016
1 parent cc2e1df commit 9e95a5c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rabbit_mqtt_processor.erl
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,16 @@ ensure_queue(Qos, #proc_state{ channels = {Channel, _},
{Q, PState}
end.

send_will(PState = #proc_state{will_msg = undefined}) ->
PState;

send_will(PState = #proc_state{will_msg = WillMsg = #mqtt_msg{retain = Retain, topic = Topic}, retainer_pid = RPid}) ->
amqp_pub(WillMsg, PState),
case Retain of
false -> ok;
true -> hand_off_to_retainer(RPid, Topic, WillMsg)
end.
end,
PState.

amqp_pub(undefined, PState) ->
PState;
Expand Down

0 comments on commit 9e95a5c

Please sign in to comment.