aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_agent.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 83dbd38e4..f84c0f011 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -2535,7 +2535,9 @@ static int unload_module(void)
/* First, take us out of the channel loop */
ast_channel_unregister(&agent_tech);
/* Delete devicestate subscription */
- agent_devicestate_sub = ast_event_unsubscribe(agent_devicestate_sub);
+ if (agent_devicestate_sub) {
+ agent_devicestate_sub = ast_event_unsubscribe(agent_devicestate_sub);
+ }
/* Unregister dialplan functions */
ast_custom_function_unregister(&agent_function);
/* Unregister CLI commands */