Fixes segfault when using ParkAndAnnounce. Also, loop made more efficient as announce...
authorJeff Peeler <jpeeler@digium.com>
Sun, 8 Jun 2008 01:16:25 +0000 (01:16 +0000)
committerJeff Peeler <jpeeler@digium.com>
Sun, 8 Jun 2008 01:16:25 +0000 (01:16 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121131 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_parkandannounce.c

index d1066fd..45740d9 100644 (file)
@@ -144,9 +144,12 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data)
 
        ast_verb(4, "Announce Template:%s\n", args.template);
 
-       for (looptemp = 0, tmp[looptemp++] = strsep(&args.template, ":");
-                looptemp < sizeof(tmp) / sizeof(tmp[0]);
-                tmp[looptemp++] = strsep(&args.template, ":"));
+       for (looptemp = 0; looptemp < sizeof(tmp) / sizeof(tmp[0]); looptemp++) {
+               if ((tmp[looptemp] = strsep(&args.template, ":")) != NULL)
+                       continue;
+               else
+                       break;
+       }
 
        for (i = 0; i < looptemp; i++) {
                ast_verb(4, "Announce:%s\n", tmp[i]);