From 4eb054792eb9fc3406b660d1dea3776fab0917cc Mon Sep 17 00:00:00 2001 From: Willem van de Krol Date: Tue, 25 Mar 2025 19:23:54 +0100 Subject: [PATCH] module/niri-workspaces: fix crash when monitor off The niri-workspaces module would crash if niri's event stream produced a `WorkspaceChanged` event containing a workspace with no output, which can occur if the monitor is turned off. Update the response parser to handle this situation. --- modules/niri-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/niri-common.c b/modules/niri-common.c index ac53921..049ae3c 100644 --- a/modules/niri-common.c +++ b/modules/niri-common.c @@ -73,7 +73,7 @@ parser(char *response) // only add workspaces on the current yambar's monitor struct json_object *output = json_object_object_get(ws_obj, "output"); - if (strcmp(instance.monitor, json_object_get_string(output)) != 0) + if (output == NULL || strcmp(instance.monitor, json_object_get_string(output)) != 0) continue; struct niri_workspace *ws = calloc(1, sizeof(*ws));