From 5f42930a418f9a83e8933344806b0c2dc6d5be6a Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Thu, 26 Sep 2013 10:27:16 +0100 Subject: [PATCH] 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 --- shared/config-parser.c | 2 +- src/compositor.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/shared/config-parser.c b/shared/config-parser.c index e1bf212f..8defbbb4 100644 --- a/shared/config-parser.c +++ b/shared/config-parser.c @@ -385,7 +385,7 @@ weston_config_parse(const char *name) const char * weston_config_get_full_path(struct weston_config *config) { - return config->path; + return config == NULL ? NULL : config->path; } int diff --git a/src/compositor.c b/src/compositor.c index a2c87259..0fa66131 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3492,8 +3492,12 @@ int main(int argc, char *argv[]) } config = weston_config_parse("weston.ini"); - weston_log("Using config file '%s'\n", - weston_config_get_full_path(config)); + if (config != NULL) { + 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); weston_config_section_get_string(section, "modules", &modules, "");