From fdb698ca2be630f0fe5ea8cf239c016633c06cbc Mon Sep 17 00:00:00 2001
From: David Vossel <dvossel@digium.com>
Date: Mon, 24 May 2010 16:10:09 +0000
Subject: [PATCH] fixes segfault when using generic plc

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265273 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/channel.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/main/channel.c b/main/channel.c
index 637f162853..ba34117e03 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -4154,6 +4154,12 @@ static void adjust_frame_for_plc(struct ast_channel *chan, struct ast_frame *fra
 	int num_new_samples = frame->samples;
 	struct plc_ds *plc = datastore->data;
 
+
+	/* If this audio frame has no samples to fill in ignore it */
+	if (!num_new_samples) {
+		return;
+	}
+
 	/* First, we need to be sure that our buffer is large enough to accomodate
 	 * the samples we need to fill in. This will likely only occur on the first
 	 * frame we write.
-- 
GitLab