diff --git a/apps/app_queue.c b/apps/app_queue.c index bd8fb5057e..1fa81dc7c0 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -2912,8 +2912,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce if (use_weight) ao2_unlock(queues); lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed); - ast_channel_datastore_remove(qe->chan, datastore); - ast_channel_datastore_free(datastore); + if (datastore) { + ast_channel_datastore_remove(qe->chan, datastore); + ast_channel_datastore_free(datastore); + } ao2_lock(qe->parent); if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY) { store_next_rr(qe, outgoing);