config: Don't crash if we don't have a config file
Adding a check in weston_config_full_path so that we don't crash if we started without a config file. Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
7b8e970ad1
commit
5f42930a41
@@ -385,7 +385,7 @@ weston_config_parse(const char *name)
|
|||||||
const char *
|
const char *
|
||||||
weston_config_get_full_path(struct weston_config *config)
|
weston_config_get_full_path(struct weston_config *config)
|
||||||
{
|
{
|
||||||
return config->path;
|
return config == NULL ? NULL : config->path;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
+6
-2
@@ -3492,8 +3492,12 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
config = weston_config_parse("weston.ini");
|
config = weston_config_parse("weston.ini");
|
||||||
weston_log("Using config file '%s'\n",
|
if (config != NULL) {
|
||||||
weston_config_get_full_path(config));
|
weston_log("Using config file '%s'\n",
|
||||||
|
weston_config_get_full_path(config));
|
||||||
|
} else {
|
||||||
|
weston_log("Starting with no config file.\n");
|
||||||
|
}
|
||||||
section = weston_config_get_section(config, "core", NULL, NULL);
|
section = weston_config_get_section(config, "core", NULL, NULL);
|
||||||
weston_config_section_get_string(section, "modules", &modules, "");
|
weston_config_section_get_string(section, "modules", &modules, "");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user