aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-11-24 12:05:41 -0300
committerdequis <dx@dxzone.com.ar>2015-11-24 12:05:41 -0300
commit5b01e1a5b69d9a86833dcd54046fe6a7832efec8 (patch)
treebcf235ba0f4b4afe9c2da75a0065c8cd3e58f714
parentad9ac5dccf8d27700850c02946ad3242a45d6fa9 (diff)
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".
-rw-r--r--protocols/jabber/presence.c2
1 files changed, 1 insertions, 1 deletions
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;