diff --git a/zet.dpi.c b/zet.dpi.c index 51149f4..903d826 100644 --- a/zet.dpi.c +++ b/zet.dpi.c @@ -228,13 +228,14 @@ static char *zet_get_title(const char *id, char *buf, size_t len) { if (sz < 0 || (size_t)sz >= sizeof(path_buf)) return NULL; int fd = open(path_buf, O_RDONLY); if (fd < 0) return NULL; - buf = zet_get_title_fd(fd, buf, len); - if (buf != NULL && *buf == '\0') { + char *title_buf = zet_get_title_fd(fd, buf, len); + if (title_buf == NULL || *title_buf == '\0') { strncpy(buf, "ยง", sigil_size); strncpy(buf + sigil_size, id, len); + title_buf = buf; } close(fd); - return buf; + return title_buf; } static int zet_stat(const char *id, struct stat *st) {