mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-24 03:47:39 +00:00
improve error checking for null path
This commit is contained in:
parent
8d10e65b79
commit
0cba8b39c3
@ -39,6 +39,10 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t *cfg, char *file_pat
|
|||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
char path_buf[1024];
|
char path_buf[1024];
|
||||||
|
|
||||||
|
if (!file_path) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (switch_is_file_path(file_path)) {
|
if (switch_is_file_path(file_path)) {
|
||||||
path = file_path;
|
path = file_path;
|
||||||
} else {
|
} 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);
|
switch_set_string(cfg->path, path);
|
||||||
|
|
||||||
while (switch_config_next_pair(cfg, &var, &val)) {
|
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;
|
cfg->lockto = cfg->sectno;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user