From b728fea5be06733c040fc02b2f629863627bfa04 Mon Sep 17 00:00:00 2001
From: Ddone <mynameisthenekit@gmail.com>
Date: Wed, 9 Jan 2019 19:38:44 +0200
Subject: [PATCH] fix(i3): crash without <label-state> (#1591)

Fixes #975
---
 src/modules/i3.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/modules/i3.cpp b/src/modules/i3.cpp
index 1c636f05..5df0106a 100644
--- a/src/modules/i3.cpp
+++ b/src/modules/i3.cpp
@@ -114,6 +114,13 @@ namespace modules {
   }
 
   bool i3_module::update() {
+    /*
+     * update only populates m_workspaces and those are only needed when
+     * <label-state> appears in the format
+     */
+    if (!m_formatter->has(TAG_LABEL_STATE)) {
+      return true;
+    }
     m_workspaces.clear();
     i3_util::connection_t ipc;