Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Enno Rehling 2019-03-31 21:18:35 +02:00
commit 29a9d8d30b
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); faction *self = (faction *)tolua_tousertype(L, 1, NULL);
const char * passw = tolua_tostring(L, 2, 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; return 0;
} }

View File

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