summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2020-06-07 14:34:09 +0200
committerMike Pall <mike>2020-06-07 14:34:09 +0200
commitf5b0fff5a990004375ad43aa6e6c4a11a8b6eb7e (patch)
treeab83d416cb363e876d0db4fe139a2a511a0f3a5f /src
parent2f3f07882fb4ad9c64967d7088461b1ca0a25d3a (diff)
downloadluajit2-f5b0fff5a990004375ad43aa6e6c4a11a8b6eb7e.tar.gz
Fix debug.debug() for non-string errors.
Diffstat (limited to 'src')
-rw-r--r--src/lib_debug.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib_debug.c b/src/lib_debug.c
index a485ff8e..07262830 100644
--- a/src/lib_debug.c
+++ b/src/lib_debug.c
@@ -369,7 +369,8 @@ LJLIB_CF(debug_debug)
return 0;
if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") ||
lua_pcall(L, 0, 0, 0)) {
- fputs(lua_tostring(L, -1), stderr);
+ const char *s = lua_tostring(L, -1);
+ fputs(s ? s : "(error object is not a string)", stderr);
fputs("\n", stderr);
}
lua_settop(L, 0); /* remove eventual returns */