瀏覽代碼

small bug building error messages

Roberto Ierusalimschy 23 年之前
父節點
當前提交
e572dffa15
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      ldebug.c

+ 6 - 2
ldebug.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldebug.c,v 1.120 2002/06/18 15:19:27 roberto Exp roberto $
+** $Id: ldebug.c,v 1.121 2002/06/18 17:10:43 roberto Exp roberto $
 ** Debug Interface
 ** See Copyright Notice in lua.h
 */
@@ -517,8 +517,9 @@ void luaG_ordererror (lua_State *L, const TObject *p1, const TObject *p2) {
 
 
 static void addinfo (lua_State *L, int internal) {
-  CallInfo *ci = (internal) ? L->ci : L->ci - 1;
   const char *msg = svalue(L->top - 1);
+  CallInfo *ci = L->ci;
+  if (!internal && ci > L->base_ci) ci--;
   if (strchr(msg, '\n')) return;  /* message already `formatted' */
   if (!isLmark(ci)) {  /* no Lua code? */
     luaO_pushfstring(L, "%s\n", msg);  /* no extra info */
@@ -543,6 +544,9 @@ void luaG_errormsg (lua_State *L, int internal) {
     L->top += 2;
     luaD_call(L, L->top - 2, 1);  /* call error function? */
   }
+  else {
+    setnilvalue(L->top++);
+  }
   luaD_throw(L, LUA_ERRRUN);
 }