summaryrefslogtreecommitdiff
path: root/main/message.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/message.c')
-rw-r--r--main/message.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/main/message.c b/main/message.c
index 70bda4150..bd706e363 100644
--- a/main/message.c
+++ b/main/message.c
@@ -871,6 +871,11 @@ static int msg_func_read(struct ast_channel *chan, const char *function,
struct ast_datastore *ds;
struct ast_msg *msg;
+ if (!chan) {
+ ast_log(LOG_WARNING, "No channel was provided to %s function.\n", function);
+ return -1;
+ }
+
ast_channel_lock(chan);
if (!(ds = ast_channel_datastore_find(chan, &msg_datastore, NULL))) {
@@ -907,6 +912,11 @@ static int msg_func_write(struct ast_channel *chan, const char *function,
struct ast_datastore *ds;
struct ast_msg *msg;
+ if (!chan) {
+ ast_log(LOG_WARNING, "No channel was provided to %s function.\n", function);
+ return -1;
+ }
+
ast_channel_lock(chan);
if (!(ds = msg_datastore_find_or_create(chan))) {
@@ -963,6 +973,11 @@ static int msg_data_func_read(struct ast_channel *chan, const char *function,
struct ast_msg *msg;
const char *val;
+ if (!chan) {
+ ast_log(LOG_WARNING, "No channel was provided to %s function.\n", function);
+ return -1;
+ }
+
ast_channel_lock(chan);
if (!(ds = ast_channel_datastore_find(chan, &msg_datastore, NULL))) {
@@ -993,6 +1008,11 @@ static int msg_data_func_write(struct ast_channel *chan, const char *function,
struct ast_datastore *ds;
struct ast_msg *msg;
+ if (!chan) {
+ ast_log(LOG_WARNING, "No channel was provided to %s function.\n", function);
+ return -1;
+ }
+
ast_channel_lock(chan);
if (!(ds = msg_datastore_find_or_create(chan))) {