]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Ensure the group information category exists before trying to do a string comparison...
authorJoshua Colp <jcolp@digium.com>
Tue, 10 Jul 2007 14:48:00 +0000 (14:48 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 10 Jul 2007 14:48:00 +0000 (14:48 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@74264 65c4cc65-6c06-0410-ace0-fbb531ad65f3

app.c

diff --git a/app.c b/app.c
index 33b318dd2c470c1e822f03dd1b5b5efb67661efe..9d1849c776fd7a747deba59eafeadb90003bfec0 100644 (file)
--- a/app.c
+++ b/app.c
@@ -1084,7 +1084,7 @@ int ast_app_group_get_count(char *group, char *category)
 
        AST_LIST_LOCK(&groups);
        AST_LIST_TRAVERSE(&groups, gi, list) {
-               if (!strcasecmp(gi->group, group) && (ast_strlen_zero(category) || !strcasecmp(gi->category, category)))
+               if (!strcasecmp(gi->group, group) && (ast_strlen_zero(category) || (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, category))))
                        count++;
        }
        AST_LIST_UNLOCK(&groups);
@@ -1107,7 +1107,7 @@ int ast_app_group_match_get_count(char *groupmatch, char *category)
 
        AST_LIST_LOCK(&groups);
        AST_LIST_TRAVERSE(&groups, gi, list) {
-               if (!regexec(&regexbuf, gi->group, 0, NULL, 0) && (ast_strlen_zero(category) || !strcasecmp(gi->category, category)))
+               if (!regexec(&regexbuf, gi->group, 0, NULL, 0) && (ast_strlen_zero(category) || (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, category))))
                        count++;
        }
        AST_LIST_UNLOCK(&groups);