fix hanging when tag is empty

This commit is contained in:
André Desgualdo Pereira 2025-10-26 10:42:24 -03:00
parent bdfee2104f
commit 1149930689

10
dwlb.c
View File

@ -209,8 +209,6 @@ static uint32_t height, textpadding, buffer_scale;
static bool run_display;
static char *last_logged_title = NULL;
#include "config.h"
static void
@ -1222,7 +1220,6 @@ read_stdin(void)
if (!(bar->window_title = strdup(wordend)))
EDIE("strdup");
bar->redraw = true;
last_logged_title = strdup(wordend);
} else if (!strcmp(wordbeg, "selmon")) {
ADVANCE();
if ((val = atoi(wordbeg)) != bar->sel) {
@ -1552,11 +1549,10 @@ read_socket(void)
hide_bar(bar);
}
} else if (!strcmp(wordbeg, "printinfo")) {
const char *info = last_logged_title ? last_logged_title : "(none)";
ssize_t len = strlen(info);
if (send(cli_fd, info, len, 0) != len) {
const char *info = (bar->window_title && bar->window_title[0] != '\0') ? bar->window_title : "(none)";
if (send(cli_fd, info, strlen(info), 0) == -1) {
perror("send");
}
}
} else if (!strcmp(wordbeg, "toggle-visibility")) {
if (all) {
wl_list_for_each(bar, &bar_list, link)