Fix ctf_marker crash (#877)

This commit is contained in:
savilli 2021-05-04 22:59:33 +02:00 committed by GitHub
parent 6d5f046d41
commit 0f5f921c0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View file

@ -69,6 +69,10 @@ minetest.register_tool("ctf_classes:sword_bronze", {
local pteam = ctf.player(pname).team local pteam = ctf.player(pname).team
if not pteam then -- can be nil during map change
return
end
if pointed_thing.type == "object" and pointed_thing.ref:is_player() then if pointed_thing.type == "object" and pointed_thing.ref:is_player() then
if ctf_match.is_in_build_time() then return end if ctf_match.is_in_build_time() then return end

View file

@ -30,17 +30,8 @@ end
-- Add waypoint element to all players in the same team as name -- Add waypoint element to all players in the same team as name
function ctf_marker.add_marker(name, tname, pos, str) function ctf_marker.add_marker(name, tname, pos, str)
local player = minetest.get_player_by_name(name)
if not player then
return
end
local team = ctf.team(tname) local team = ctf.team(tname)
if not tname then
minetest.log("error", "Team name not provided to ctf_marker.add_marker()")
end
teams[tname] = { teams[tname] = {
players = {}, players = {},
time = 0 time = 0
@ -101,6 +92,9 @@ minetest.register_chatcommand("m", {
end end
local tname = ctf.player(name).team local tname = ctf.player(name).team
if not tname then -- can be nil during map change
return
end
-- Handle waypoint string -- Handle waypoint string
local str = (param and param:trim() ~= "") and ": " .. param or "" local str = (param and param:trim() ~= "") and ": " .. param or ""