The client can be NULL, so don't try and access c->name before we've
checked if the client is not NULL.
---
 cmd-queue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cmd-queue.c b/cmd-queue.c
index 077599fb..26e2f2f9 100644
--- a/cmd-queue.c
+++ b/cmd-queue.c
@@ -540,11 +540,12 @@ cmdq_add_message(struct cmdq_item *item)
 {
        struct client           *c = item->client;
        struct cmdq_state       *state = item->state;
-       const char              *name = c->name, *key;
+       const char              *name, *key;
        char                    *tmp;
 
        tmp = cmd_print(item->cmd);
        if (c != NULL) {
+               name = c->name;
                if (c->session != NULL && state->event.key != KEYC_NONE) {
                        key = key_string_lookup_key(state->event.key);
                        server_add_message("%s key %s: %s", name, key, tmp);
-- 
2.26.1

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/tmux-users/20200506233443.64139-1-thomas%40xteddy.org.

Reply via email to