aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2018-07-01 23:36:44 +0900
committerDominique Martinet <asmadeus@codewreck.org>2018-07-02 08:03:41 +0900
commit4eeca10a8a1bdef73c0ad7dc8e4d74bb31507676 (patch)
tree889e0d9af9f128bfa947d2db2cba5ceb5a697675 /sway
parent8c526bbb03a5171422cf71b0217d271feeb072b6 (diff)
load_config: move NULL path check before first use
Found through static analysis
Diffstat (limited to 'sway')
-rw-r--r--sway/config.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sway/config.c b/sway/config.c
index 8b6f7b6f..0aae1696 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -302,6 +302,11 @@ static char *get_config_path(void) {
const char *current_config_path;
static bool load_config(const char *path, struct sway_config *config) {
+ if (path == NULL) {
+ wlr_log(L_ERROR, "Unable to find a config file!");
+ return false;
+ }
+
wlr_log(L_INFO, "Loading config from %s", path);
current_config_path = path;
@@ -310,11 +315,6 @@ static bool load_config(const char *path, struct sway_config *config) {
return false;
}
- if (path == NULL) {
- wlr_log(L_ERROR, "Unable to find a config file!");
- return false;
- }
-
FILE *f = fopen(path, "r");
if (!f) {
wlr_log(L_ERROR, "Unable to open %s for reading", path);