improve error checking for null path

This commit is contained in:
Michael Jerris 2014-04-28 15:12:02 -04:00
parent 8d10e65b79
commit 0cba8b39c3
1 changed files with 5 additions and 1 deletions

View File

@ -39,6 +39,10 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t *cfg, char *file_pat
char *path = NULL;
char path_buf[1024];
if (!file_path) {
return 0;
}
if (switch_is_file_path(file_path)) {
path = file_path;
} else {
@ -69,7 +73,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t *cfg, char *file_pat
switch_set_string(cfg->path, path);
while (switch_config_next_pair(cfg, &var, &val)) {
if (file_path && (cfg->sectno != last) && !strcmp(cfg->section, file_path)) {
if ((cfg->sectno != last) && !strcmp(cfg->section, file_path)) {
cfg->lockto = cfg->sectno;
return 1;
}