]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
improve error checking for null path
authorMichael Jerris <mike@jerris.com>
Mon, 28 Apr 2014 19:12:02 +0000 (15:12 -0400)
committerMichael Jerris <mike@jerris.com>
Mon, 28 Apr 2014 19:12:02 +0000 (15:12 -0400)
src/switch_config.c

index 93fcfad7ade3c5d47875a5ac6cc2e85dbcafc3a8..143d7eb34f78b95b51af3cd5e232791457a6b9a2 100644 (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;
                                }