Fix server crash on /clearpassword

According to #253, using `/clearpassword` without an argument causes the server to crash from an assertion failure. I've resubmitted matttpt's patch as a pull request to aid in merging.
pull/290/merge
Anthony 2012-11-18 18:18:45 -05:00 committed by PilzAdam
parent 5292476841
commit 3ba9b26310
1 changed files with 2 additions and 2 deletions

View File

@ -215,8 +215,8 @@ minetest.register_chatcommand("clearpassword", {
privs = {password=true},
func = function(name, param)
toname = param
if not toname then
minetest.chat_send_player(toname, "Name field required")
if toname == "" then
minetest.chat_send_player(name, "Name field required")
return
end
minetest.set_player_password(toname, '')