[asterisk-commits] mmichelson: branch mmichelson/agent_experiment r376380 - /team/mmichelson/age...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Nov 15 21:47:04 CST 2012
Author: mmichelson
Date: Thu Nov 15 21:47:01 2012
New Revision: 376380
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376380
Log:
Don't crash if the agent has no current state.
Ideally, when an agent is created, he'd be put in some sort
of initial state rather than just having none. For now
anyway, just have the function that changes states able
to cope with the fact that the agent may have a NULL state.
Modified:
team/mmichelson/agent_experiment/channels/chan_agent2.c
Modified: team/mmichelson/agent_experiment/channels/chan_agent2.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/agent_experiment/channels/chan_agent2.c?view=diff&rev=376380&r1=376379&r2=376380
==============================================================================
--- team/mmichelson/agent_experiment/channels/chan_agent2.c (original)
+++ team/mmichelson/agent_experiment/channels/chan_agent2.c Thu Nov 15 21:47:01 2012
@@ -318,9 +318,11 @@
static int change_agent_state(struct agent *agent, const struct agent_state *new_state)
{
- ast_debug(1, "Agent %s exiting state %s\n", agent->cfg->id, agent->current_state->name);
- if (agent->current_state->exit && agent->current_state->exit(agent)) {
- return -1;
+ if (agent->current_state) {
+ ast_debug(1, "Agent %s exiting state %s\n", agent->cfg->id, agent->current_state->name);
+ if (agent->current_state->exit && agent->current_state->exit(agent)) {
+ return -1;
+ }
}
agent->current_state = new_state;
More information about the asterisk-commits
mailing list