From 08139daaa418c21f215d0adf6916db472fd474ef Mon Sep 17 00:00:00 2001
From: John Axel Eriksson <john@insane.se>
Date: Mon, 8 Oct 2018 15:09:25 +0200
Subject: [PATCH] Check if there is a current container before setting it's
 opacity

---
 sway/commands/opacity.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sway/commands/opacity.c b/sway/commands/opacity.c
index 9cdaad7f4..4e4fc9944 100644
--- a/sway/commands/opacity.c
+++ b/sway/commands/opacity.c
@@ -21,6 +21,10 @@ struct cmd_results *cmd_opacity(int argc, char **argv) {
 
 	struct sway_container *con = config->handler_context.container;
 
+	if (con == NULL) {
+		return cmd_results_new(CMD_FAILURE, "opacity", "No current container");
+	}
+
 	float opacity = 0.0f;
 
 	if (!parse_opacity(argv[0], &opacity)) {