summaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ltests.c b/ltests.c
index 7e6d8610..314505c3 100644
--- a/ltests.c
+++ b/ltests.c
@@ -73,8 +73,10 @@ static void badexit (const char *fmt, const char *s1, const char *s2) {
static int tpanic (lua_State *L) {
+ const char *msg = lua_tostring(L, -1);
+ if (msg == NULL) msg = "error object is not a string";
return (badexit("PANIC: unprotected error in call to Lua API (%s)\n",
- lua_tostring(L, -1), NULL),
+ msg, NULL),
0); /* do not return to Lua */
}