Lua has a garbage collector, it may dispose of strings while we're using them, make throw_error a little more safe
This commit is contained in:
parent
f51fe2c983
commit
500cfc3746
@ -143,9 +143,14 @@ int luatpt_test(lua_State* l)
|
|||||||
int luatpt_error(lua_State* l)
|
int luatpt_error(lua_State* l)
|
||||||
{
|
{
|
||||||
char *error = "";
|
char *error = "";
|
||||||
error = luaL_optstring(l, 1, 0);
|
error = mystrdup(luaL_optstring(l, 1, "Error text"));
|
||||||
error_ui(vid_buf, 0, error);
|
if(vid_buf!=NULL){
|
||||||
return 0;
|
error_ui(vid_buf, 0, error);
|
||||||
|
free(error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
free(error);
|
||||||
|
return luaL_error(l, "Screen buffer does not exist");
|
||||||
}
|
}
|
||||||
int luatpt_drawtext(lua_State* l)
|
int luatpt_drawtext(lua_State* l)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user