Fix exception when passing nil to some functions in interface api, fixes #849
This commit is contained in:
parent
c603c41b92
commit
a0016a2b9c
@ -62,8 +62,7 @@ int LuaButton::text(lua_State * l)
|
||||
int args = lua_gettop(l);
|
||||
if(args)
|
||||
{
|
||||
luaL_checktype(l, 1, LUA_TSTRING);
|
||||
button->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
||||
button->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@ -60,7 +60,7 @@ int LuaCheckbox::text(lua_State * l)
|
||||
int args = lua_gettop(l);
|
||||
if(args)
|
||||
{
|
||||
checkbox->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
||||
checkbox->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@ -37,7 +37,7 @@ int LuaLabel::text(lua_State * l)
|
||||
int args = lua_gettop(l);
|
||||
if(args)
|
||||
{
|
||||
label->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
||||
label->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@ -53,7 +53,7 @@ int LuaProgressBar::status(lua_State * l)
|
||||
int args = lua_gettop(l);
|
||||
if(args)
|
||||
{
|
||||
progressBar->SetStatus(ByteString(lua_tostring(l, 1)).FromUtf8());
|
||||
progressBar->SetStatus(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@ -77,7 +77,7 @@ int LuaTextbox::text(lua_State * l)
|
||||
int args = lua_gettop(l);
|
||||
if(args)
|
||||
{
|
||||
textbox->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
||||
textbox->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user