From f39cbc004d8ed8a14c8be57a6afa4f54585d49f7 Mon Sep 17 00:00:00 2001
From: Matthew Nicholson <mnicholson@digium.com>
Date: Fri, 21 Oct 2011 16:42:56 +0000
Subject: [PATCH] only process args that exist

ASTERISK-18395
........

Merged revisions 341809 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 341810 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@341811 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 pbx/pbx_lua.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pbx/pbx_lua.c b/pbx/pbx_lua.c
index db6090a600..0dccfe644d 100644
--- a/pbx/pbx_lua.c
+++ b/pbx/pbx_lua.c
@@ -669,7 +669,7 @@ static void lua_concat_args(lua_State *L, int start, int nargs) {
 	int concat = 0;
 	int i = start + 1;
 
-	if (!lua_isnil(L, start)) {
+	if (start <= nargs && !lua_isnil(L, start)) {
 		lua_pushvalue(L, start);
 		concat += 1;
 	}