Skip to content
Snippets Groups Projects
Commit f556c31a authored by Joshua Colp's avatar Joshua Colp Committed by Gerrit Code Review
Browse files

Merge "app_directory: Handle a NULL mailbox without crashing"

parents f40b2901 1bdbefbe
Branches
Tags
No related merge requests found
...@@ -509,6 +509,11 @@ static struct ast_config *realtime_directory(char *context) ...@@ -509,6 +509,11 @@ static struct ast_config *realtime_directory(char *context)
const char *mailbox = ast_variable_retrieve(rtdata, category, "mailbox"); const char *mailbox = ast_variable_retrieve(rtdata, category, "mailbox");
const char *ctx = ast_variable_retrieve(rtdata, category, "context"); 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"); fullname = ast_variable_retrieve(rtdata, category, "fullname");
hidefromdir = ast_variable_retrieve(rtdata, category, "hidefromdir"); hidefromdir = ast_variable_retrieve(rtdata, category, "hidefromdir");
if (ast_true(hidefromdir)) { if (ast_true(hidefromdir)) {
...@@ -529,7 +534,7 @@ static struct ast_config *realtime_directory(char *context) ...@@ -529,7 +534,7 @@ static struct ast_config *realtime_directory(char *context)
/* Does the context exist within the config file? If not, make one */ /* Does the context exist within the config file? If not, make one */
if (!(cat = ast_category_get(cfg, ctx, NULL))) { 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_log(LOG_WARNING, "Out of memory\n");
ast_config_destroy(cfg); ast_config_destroy(cfg);
if (rtdata) { if (rtdata) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment