Labels are sometimes (most of the time?) NULL for extensions.
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 23 Apr 2009 20:42:11 +0000 (20:42 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 23 Apr 2009 20:42:11 +0000 (20:42 +0000)
(closes issue #14895)
 Reported by: chris-mac
 Patches:
       20090423__bug14895__2.diff.txt uploaded by tilghman (license 14)
 Tested by: lmadsen

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190352 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/pbx.c

index ff9a162..0c7105a 100644 (file)
@@ -1031,7 +1031,7 @@ static int hashtab_compare_exten_labels(const void *ah_a, const void *ah_b)
 {
        const struct ast_exten *ac = ah_a;
        const struct ast_exten *bc = ah_b;
-       return strcmp(ac->label, bc->label);
+       return strcmp(S_OR(ac->label, ""), S_OR(bc->label, ""));
 }
 
 unsigned int ast_hashtab_hash_contexts(const void *obj)
@@ -1059,7 +1059,7 @@ static unsigned int hashtab_hash_priority(const void *obj)
 static unsigned int hashtab_hash_labels(const void *obj)
 {
        const struct ast_exten *ac = obj;
-       return ast_hashtab_hash_string(ac->label);
+       return ast_hashtab_hash_string(S_OR(ac->label, ""));
 }