mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Bug 945: Don't crash if the error message is not a string.
[ From commit c645ed7485
in ELinks
0.11.2.GIT. --KON ]
This commit is contained in:
parent
c69ee15963
commit
ba1cef8db4
@ -70,7 +70,13 @@ static void handle_ref(LS, struct session *ses, int func_ref,
|
||||
static int
|
||||
l_alert(LS)
|
||||
{
|
||||
alert_lua_error((unsigned char *) lua_tostring(S, 1));
|
||||
unsigned char *msg = (unsigned char *) lua_tostring(S, 1);
|
||||
|
||||
/* Don't crash if a script calls e.g. error(nil) or error(error). */
|
||||
if (msg == NULL)
|
||||
msg = "(cannot convert the error message to a string)";
|
||||
|
||||
alert_lua_error(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user