prevent null-pointer crash when reading f.password (TODO: write-only variables are dumb)

This commit is contained in:
Enno Rehling 2016-01-14 21:23:53 +01:00
parent 4fb453863d
commit 568e1a2976
1 changed files with 7 additions and 1 deletions

View File

@ -382,6 +382,12 @@ static int tolua_faction_create(lua_State * L)
return 1;
}
static int tolua_faction_get_password(lua_State * L)
{
unused_arg(L);
return 0;
}
static int tolua_faction_set_password(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, 0);
@ -557,7 +563,7 @@ void tolua_faction_open(lua_State * L)
tolua_variable(L, TOLUA_CAST "heroes", tolua_faction_get_heroes, NULL);
tolua_variable(L, TOLUA_CAST "maxheroes", tolua_faction_get_maxheroes,
NULL);
tolua_variable(L, TOLUA_CAST "password", NULL,
tolua_variable(L, TOLUA_CAST "password", tolua_faction_get_password,
tolua_faction_set_password);
tolua_variable(L, TOLUA_CAST "email", tolua_faction_get_email,
tolua_faction_set_email);