ctf_classes: Fix crash when player meta contains invalid class name (#607)
This commit is contained in:
parent
3a0397ee28
commit
b1aa1366f4
1 changed files with 5 additions and 1 deletions
|
@ -59,7 +59,11 @@ function ctf_classes.get(player)
|
||||||
player = minetest.get_player_by_name(player)
|
player = minetest.get_player_by_name(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
local cname = player:get_meta():get("ctf_classes:class") or ctf_classes.default_class
|
-- Return class from player meta if valid, or default class
|
||||||
|
local cname = player:get_meta():get("ctf_classes:class")
|
||||||
|
if not ctf_classes.__classes[cname] then
|
||||||
|
cname = ctf_classes.default_class
|
||||||
|
end
|
||||||
return ctf_classes.__classes[cname]
|
return ctf_classes.__classes[cname]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue