From: Matt Mullins Date: Thu, 1 Sep 2011 19:42:22 +0000 (-0500) Subject: Fix a bug to allow channels that do not have AMQP queues X-Git-Tag: v5~8 X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=b42ea9768346a078c6945d8cccb687440e86a2d7;p=erlbot.git Fix a bug to allow channels that do not have AMQP queues --- diff --git a/irc/irc_conn.erl b/irc/irc_conn.erl index f4ed6cc..d8d3d5e 100644 --- a/irc/irc_conn.erl +++ b/irc/irc_conn.erl @@ -136,10 +136,12 @@ join_channel(Channel, State) -> #irc_state{object_sup = ObjectSup, instance = Instance } = State, - - {{Instance, Channel}, RoutingKey} = lists:keyfind({Instance, Channel}, - 1, config:get_config(irc_amqp_bind)), - {ok, _ChildPid} = irc_object_sup:add_amqp_listener(ObjectSup, self(), Channel, RoutingKey). + case lists:keyfind({Instance, Channel}, 1, config:get_config(irc_amqp_bind)) of + {{Instance, Channel}, RoutingKey} -> + {ok, _ChildPid} = irc_object_sup:add_amqp_listener( + ObjectSup, self(), Channel, RoutingKey); + false -> ok + end. %% @doc Splits a buffer into full lines, keeping whatever is left over %% Returns either {ok, [Line], Remaining} or none.