#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.