提交 0cba8b39 authored 作者: Michael Jerris's avatar Michael Jerris

improve error checking for null path

上级 8d10e65b
......@@ -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;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论