summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-09-05 08:27:19 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-09-05 08:27:19 -0500
commitca19d0991459b5823ad8d73ffc9411f79ef8db80 (patch)
tree91d0c10c17b50ddf8ffc2970497a45991ef14519
parentf05297abf27356d11c92d3359585ef6036e51d89 (diff)
parent8af99e579441fd40522e7a750c4e7d7a4b790f4f (diff)
Merge "app_directory: Handle a NULL mailbox without crashing" into 14
-rw-r--r--apps/app_directory.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c
index 95cb0d90d..06f94288e 100644
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -511,6 +511,11 @@ static struct ast_config *realtime_directory(char *context)
const char *mailbox = ast_variable_retrieve(rtdata, category, "mailbox");
const char *ctx = ast_variable_retrieve(rtdata, category, "context");
+ if (ast_strlen_zero(mailbox)) {
+ ast_debug(3, "Skipping result with missing or empty mailbox\n");
+ continue;
+ }
+
fullname = ast_variable_retrieve(rtdata, category, "fullname");
hidefromdir = ast_variable_retrieve(rtdata, category, "hidefromdir");
if (ast_true(hidefromdir)) {
@@ -531,7 +536,7 @@ static struct ast_config *realtime_directory(char *context)
/* Does the context exist within the config file? If not, make one */
if (!(cat = ast_category_get(cfg, ctx, NULL))) {
- if (!(cat = ast_category_new(ctx, "", 99999))) {
+ if (!(cat = ast_category_new_dynamic(ctx))) {
ast_log(LOG_WARNING, "Out of memory\n");
ast_config_destroy(cfg);
if (rtdata) {