diff --git a/sway/commands/bar/colors.c b/sway/commands/bar/colors.c index ea2b912d..2d5b22bf 100644 --- a/sway/commands/bar/colors.c +++ b/sway/commands/bar/colors.c @@ -24,6 +24,9 @@ static char *hex_to_rgba_hex(const char *hex) { return NULL; } char *rgba = malloc(10); + if (!rgba) { + return NULL; + } snprintf(rgba, 10, "#%08x", color); return rgba; } @@ -36,7 +39,7 @@ static struct cmd_results *parse_single_color(char **color, } char *rgba = hex_to_rgba_hex(argv[0]); - if (!*rgba) { + if (!rgba) { return cmd_results_new(CMD_INVALID, "Invalid color: %s", argv[0]); }