diff options
| -rw-r--r-- | lua.c | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -115,12 +115,13 @@ static void l_message (const char *pname, const char *msg) { | |||
| 115 | 115 | ||
| 116 | /* | 116 | /* |
| 117 | ** Check whether 'status' is not OK and, if so, prints the error | 117 | ** Check whether 'status' is not OK and, if so, prints the error |
| 118 | ** message on the top of the stack. It assumes that the error object | 118 | ** message on the top of the stack. |
| 119 | ** is a string, as it was either generated by Lua or by 'msghandler'. | ||
| 120 | */ | 119 | */ |
| 121 | static int report (lua_State *L, int status) { | 120 | static int report (lua_State *L, int status) { |
| 122 | if (status != LUA_OK) { | 121 | if (status != LUA_OK) { |
| 123 | const char *msg = lua_tostring(L, -1); | 122 | const char *msg = lua_tostring(L, -1); |
| 123 | if (msg == NULL) | ||
| 124 | msg = "(error message not a string)"; | ||
| 124 | l_message(progname, msg); | 125 | l_message(progname, msg); |
| 125 | lua_pop(L, 1); /* remove message */ | 126 | lua_pop(L, 1); /* remove message */ |
| 126 | } | 127 | } |
