diff --git a/rtp.c b/rtp.c
index bd29e044b4615b0b14bd6aeb21d73b22ea6b045b..cb66ea9e8493d10934259b2f60a479e7859497fd 100755
--- a/rtp.c
+++ b/rtp.c
@@ -137,7 +137,7 @@ static int g723_samples(unsigned char *buf, int maxlen)
 	int res;
 	while(pos < maxlen) {
 		res = g723_len(buf[pos]);
-		if (res < 0)
+		if (res <= 0)
 			break;
 		samples += 240;
 		pos += res;