<p>Christof Lauber has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8861">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pbx_lua: Support displaying lua error message if no debug table exists<br><br>The lua_error_function assumed that lua's debug table and traceback function<br>are always accessible, which is not the case. This fixes the error message<br>'Error in the lua error handler' triggred by switch exec() function.<br>If this happens lua's error message is shown without traceback.<br><br>Change-Id: I098c4e8bfe1598a0d4cf6f93a083b01a9b7639ac<br>---<br>M pbx/pbx_lua.c<br>1 file changed, 13 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/61/8861/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/pbx/pbx_lua.c b/pbx/pbx_lua.c<br>index 741e950..46c2c0a 100644<br>--- a/pbx/pbx_lua.c<br>+++ b/pbx/pbx_lua.c<br>@@ -805,7 +805,20 @@<br> lua_pushliteral(L, "\n");<br> <br> lua_getglobal(L, "debug");<br>+ if (!lua_istable(L, -1)) {<br>+ /* Have no 'debug' table for whatever reason */<br>+ lua_pop(L, 2);<br>+ /* Keep at least original err message */<br>+ lua_pushvalue(L, message_index);<br>+ return 1;<br>+ }<br> lua_getfield(L, -1, "traceback");<br>+ if (!lua_isfunction(L, -1)) {<br>+ /* Same here for traceback function */<br>+ lua_pop(L, 3);<br>+ lua_pushvalue(L, message_index);<br>+ return 1;<br>+ }<br> lua_remove(L, -2); /* remove the 'debug' table */<br> <br> lua_pushvalue(L, message_index);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8861">change 8861</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8861"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I098c4e8bfe1598a0d4cf6f93a083b01a9b7639ac </div>
<div style="display:none"> Gerrit-Change-Number: 8861 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Christof Lauber <christof.lauber@annax.ch> </div>