From: Mark Michelson Date: Tue, 20 Mar 2012 19:30:07 +0000 (+0000) Subject: Get rid of an annoying "Possible programming error" message. X-Git-Tag: certified/1.8.11-cert1~3^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c612e030a837aa63ae5d267c87d2b27d800bf0a;p=thirdparty%2Fasterisk.git Get rid of an annoying "Possible programming error" message. If an extension's 'app' field is NULL, then a "(null)" string would be written into an ast_str due to the way that snprintf works. When this is passed to ast_strlen_zero(), it fires up a big warning indicating something is probably wrong. There indeed was a problem, but luckily it wasn't a very big problem. After the failed ast_strlen_zero() check and big warning message, the very next if statement, checking to see if the "(null)" matched a presence provider, would fail, so no harm was done. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@360031 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/pbx.c b/main/pbx.c index 4457dead7d..5f6c37b07e 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -4546,6 +4546,7 @@ static int handle_presencechange(void *datap) i = ao2_iterator_init(hints, 0); for (; (hint = ao2_iterator_next(&i)); ao2_ref(hint, -1)) { struct ast_state_cb *state_cb; + const char *app; char *parse; ao2_lock(hint); @@ -4557,14 +4558,14 @@ static int handle_presencechange(void *datap) } /* Does this hint monitor the device that changed state? */ - ast_str_set(&hint_app, 0, "%s", ast_get_extension_app(hint->exten)); - parse = parse_hint_presence(hint_app); - if (ast_strlen_zero(parse)) { + app = ast_get_extension_app(hint->exten); + if (ast_strlen_zero(app)) { /* The hint does not monitor presence at all. */ ao2_unlock(hint); continue; } - + ast_str_set(&hint_app, 0, "%s", app); + parse = parse_hint_presence(hint_app); if (strcasecmp(parse, pc->provider)) { /* The hint does not monitor the presence provider. */ ao2_unlock(hint);