Prevents from division by zero
authorMatthias Nick <mnick@digium.com>
Wed, 30 Sep 2009 21:15:01 +0000 (21:15 +0000)
committerMatthias Nick <mnick@digium.com>
Wed, 30 Sep 2009 21:15:01 +0000 (21:15 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@221436 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c

index a8d9832..7b19f9f 100644 (file)
@@ -2911,7 +2911,7 @@ static int say_periodic_announcement(struct queue_ent *qe, int ringing)
 
        ast_verb(3, "Playing periodic announcement\n");
        
-       if (qe->parent->randomperiodicannounce) {
+       if (qe->parent->randomperiodicannounce && qe->parent->numperiodicannounce) {
                qe->last_periodic_announce_sound = ((unsigned long) ast_random()) % qe->parent->numperiodicannounce;
        } else if (qe->last_periodic_announce_sound >= qe->parent->numperiodicannounce || 
                ast_str_strlen(qe->parent->sound_periodicannounce[qe->last_periodic_announce_sound]) == 0) {