Merge branch 'master' of github.com:ennorehling/eressea

This commit is contained in:
Enno Rehling 2019-04-07 16:07:10 +02:00
commit 94f54dc105
2 changed files with 8 additions and 3 deletions

View File

@ -383,7 +383,8 @@ static int tolua_faction_set_password(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
const char * passw = tolua_tostring(L, 2, NULL);
faction_setpassword(self, password_hash(passw, PASSWORD_DEFAULT));
faction_setpassword(self,
passw ? password_hash(passw, PASSWORD_DEFAULT) : NULL);
return 0;
}

View File

@ -564,8 +564,12 @@ const char *faction_getpassword(const faction *f) {
void faction_setpassword(faction * f, const char *pwhash)
{
assert(pwhash);
f->password_id = dbstring_save(pwhash);
if (pwhash) {
f->password_id = dbstring_save(pwhash);
}
else {
f->password_id = 0;
}
}
bool valid_race(const struct faction *f, const struct race *rc)