diff options
author | Joshua Colp <jcolp@digium.com> | 2017-09-05 08:20:26 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-09-05 08:20:26 -0500 |
commit | 7b240d173436ad828008d1cb3c1eae10932518be (patch) | |
tree | 2fb69a3d86eeff985279223c47a546625b278377 | |
parent | 6b9d18be7a9f00c62e4006eba42f4c030bf2fc94 (diff) | |
parent | 5f4863d4f9b707ba66bf94302f641d3aee438f7c (diff) |
Merge "app_directory: Handle a NULL mailbox without crashing" into 13
-rw-r--r-- | apps/app_directory.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c index b75e85763..9cfcbf862 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) { |