From 464d387044a7b2d2127bbd8ce20bcca160bee24f Mon Sep 17 00:00:00 2001 From: Francesco Mazzoli Date: Sat, 3 Nov 2012 11:17:30 +0000 Subject: [PATCH] take care of non-existant old workspaces --- docs/ipc | 4 +++- src/workspace.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/ipc b/docs/ipc index ae833c9f..ff60dbd1 100644 --- a/docs/ipc +++ b/docs/ipc @@ -646,7 +646,9 @@ This event consists of a single serialized map containing a property +change (string)+ which indicates the type of the change ("focus", "init", "empty", "urgent"). Additionally, when the change is "focus", an +old (object)+ and a +current (object)+ properties will be present with the -previous and current workspace respectively. +previous and current workspace respectively. When the first switch +occurs (when i3 focuses the workspace visible at the beginning) there is +no previous workspace, and the +old+ property will be set to +null+. *Example:* --------------------- diff --git a/src/workspace.c b/src/workspace.c index d4354898..fbd68dba 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -350,7 +350,10 @@ static void _workspace_focus_event(Con *current, Con *old) { dump_node(gen, current, false); ystr("old"); - dump_node(gen, old, false); + if (old == NULL) + y(null); + else + dump_node(gen, old, false); y(map_close); -- 2.39.5