fix: avoid use null mon when in mmsg

This commit is contained in:
DreamMaoMao 2026-05-26 20:12:55 +08:00
parent d20d708a95
commit 887a50a54e
2 changed files with 4 additions and 2 deletions

View file

@ -154,11 +154,13 @@ static cJSON *monitor_active_tags(Monitor *m) {
static cJSON *build_client_json(Client *c) { static cJSON *build_client_json(Client *c) {
cJSON *obj = cJSON_CreateObject(); cJSON *obj = cJSON_CreateObject();
cJSON_AddNumberToObject(obj, "id", c->id); cJSON_AddNumberToObject(obj, "id", c->id);
cJSON_AddNumberToObject(obj, "pid", c->pid); cJSON_AddNumberToObject(obj, "pid", c->pid);
cJSON_AddStringToObject(obj, "title", client_get_title(c)); cJSON_AddStringToObject(obj, "title", client_get_title(c));
cJSON_AddStringToObject(obj, "appid", client_get_appid(c)); cJSON_AddStringToObject(obj, "appid", client_get_appid(c));
cJSON_AddStringToObject(obj, "monitor", c->mon->wlr_output->name); cJSON_AddStringToObject(obj, "monitor",
c->mon ? c->mon->wlr_output->name : "");
cJSON_AddItemToObject(obj, "tags", tags_mask_to_array(c->tags)); cJSON_AddItemToObject(obj, "tags", tags_mask_to_array(c->tags));
cJSON_AddBoolToObject(obj, "is_focused", c->isfocusing); cJSON_AddBoolToObject(obj, "is_focused", c->isfocusing);
cJSON_AddBoolToObject(obj, "is_fullscreen", c->isfullscreen); cJSON_AddBoolToObject(obj, "is_fullscreen", c->isfullscreen);