AmendHub

Download:

jcs

/

wallops

/

amendments

/

136

chatter: tab->conn can be NULL during initial layout, check first


jcs made amendment 136 about 1 year ago
--- chatter.c Sun Sep 22 16:46:36 2024 +++ chatter.c Fri Oct 4 15:47:14 2024 @@ -457,7 +457,7 @@ chatter_close(struct focusable *focusable) bool connected = false; SLIST_FOREACH(tab, &chatter->tabs_list, list) { - if (tab->conn->state == IRC_STATE_CONNECTED) { + if (tab->conn && tab->conn->state == IRC_STATE_CONNECTED) { connected = true; break; } @@ -536,6 +536,9 @@ chatter_idle(struct focusable *focusable, EventRecord TEIdle(chatter->input_te); SLIST_FOREACH(tab, &chatter->tabs_list, list) { + if (!tab->conn) + continue; + was_state = tab->conn->state; irc_process(tab->conn); @@ -695,7 +698,7 @@ chatter_draw_tab_bar(struct chatter *chatter) len = strlcpy(label, tab->channel->name, sizeof(label)); else if (tab->query_nick[0]) len = strlcpy(label, tab->query_nick, sizeof(label)); - else if (tab->conn->state >= IRC_STATE_UNREGISTERED) + else if (tab->conn && tab->conn->state >= IRC_STATE_UNREGISTERED) len = strlcpy(label, tab->conn->hostname, sizeof(label)); else { tlabel = (char *)&no_connection;