1
0
mirror of https://github.com/Uberi/Minetest-WorldEdit.git synced 2025-06-28 14:16:18 +02:00

Add nil checks around get_player_by_name()

in case someone uses the commands from ncurses
This commit is contained in:
sfan5
2024-04-22 18:08:04 +02:00
parent 1d8d9a704f
commit 60b6b205ad
4 changed files with 18 additions and 10 deletions

View File

@ -136,7 +136,8 @@ end
-- Return the marker that is closest to the player
worldedit.marker_get_closest_to_player = function(name)
local playerpos = minetest.get_player_by_name(name):get_pos()
local player = assert(minetest.get_player_by_name(name))
local playerpos = player:get_pos()
local dist1 = vector.distance(playerpos, worldedit.pos1[name])
local dist2 = vector.distance(playerpos, worldedit.pos2[name])