aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ldo.c b/ldo.c
index 3ddc5a4c..84f7bbb2 100644
--- a/ldo.c
+++ b/ldo.c
@@ -112,12 +112,16 @@ void luaD_seterrorobj (lua_State *L, TStatus errcode, StkId oldtop) {
112 break; 112 break;
113 } 113 }
114 default: { 114 default: {
115 lua_assert(errorstatus(errcode)); /* real error */ 115 lua_assert(errorstatus(errcode)); /* must be a real error */
116 setobjs2s(L, oldtop, L->top.p - 1); /* error message on current top */ 116 if (!ttisnil(s2v(L->top.p - 1))) { /* error object is not nil? */
117 setobjs2s(L, oldtop, L->top.p - 1); /* move it to 'oldtop' */
118 }
119 else /* change it to a proper message */
120 setsvalue2s(L, oldtop, luaS_newliteral(L, "<error object is nil>"));
117 break; 121 break;
118 } 122 }
119 } 123 }
120 L->top.p = oldtop + 1; 124 L->top.p = oldtop + 1; /* top goes back to old top plus error object */
121} 125}
122 126
123 127