From 5b01e1a5b69d9a86833dcd54046fe6a7832efec8 Mon Sep 17 00:00:00 2001 From: dequis Date: Tue, 24 Nov 2015 12:05:41 -0300 Subject: jabber: Fix detection of away state in choose_priority() Thanks to this clang warning: comparison of array 'jd->away_state->code' not equal to a null pointer is always true [-Wtautological-pointer-compare] Although... given how ->code is offset 0, that might have worked sometimes if jd->away_state is null, assuming a compiler that doesn't hate humanity. Sadly, that is not something we can safely assume. I bet gcc saw this and thought "let's optimize your poor soul away". --- protocols/jabber/presence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/jabber/presence.c b/protocols/jabber/presence.c index c8664a24..14060148 100644 --- a/protocols/jabber/presence.c +++ b/protocols/jabber/presence.c @@ -185,7 +185,7 @@ static char *choose_priority(struct im_connection *ic) struct jabber_data *jd = ic->proto_data; char *prio = set_getstr(&ic->acc->set, "priority"); - if (jd->away_state->code != NULL) { + if (jd->away_state && jd->away_state->full_name != NULL) { int new_prio = (atoi(prio) - 5); if (new_prio < 0) { new_prio = 0; -- cgit v1.2.3