summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-07-27 02:19:52 +0000
committerMark Spencer <markster@digium.com>2004-07-27 02:19:52 +0000
commit00f3bf560bcb7bbd37c9112f86834accba8775e7 (patch)
tree914cd1496201cf8ae9ec2784ee495ab8fb5ecdb1 /channels
parent5bd8cf6cdec548241f9d9158cc1c89c051197b03 (diff)
Make sure index >= 0 before initializing
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3518 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_zap.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index de3f67a74..c1e276fb2 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -3750,6 +3750,13 @@ struct ast_frame *zt_read(struct ast_channel *ast)
index = zt_get_index(ast, p, 0);
+ /* Hang up if we don't really exist */
+ if (index < 0) {
+ ast_log(LOG_WARNING, "We dont exist?\n");
+ ast_mutex_unlock(&p->lock);
+ return NULL;
+ }
+
p->subs[index].f.frametype = AST_FRAME_NULL;
p->subs[index].f.datalen = 0;
p->subs[index].f.samples = 0;
@@ -3761,13 +3768,6 @@ struct ast_frame *zt_read(struct ast_channel *ast)
p->subs[index].f.src = "zt_read";
p->subs[index].f.data = NULL;
- /* Hang up if we don't really exist */
- if (index < 0) {
- ast_log(LOG_WARNING, "We dont exist?\n");
- ast_mutex_unlock(&p->lock);
- return NULL;
- }
-
/* make sure it sends initial key state as first frame */
if (p->radio && (!p->firstradio))
{