Fix crash on user that has left the game
parent
a975d2afc5
commit
60d86c9f93
7
api.lua
7
api.lua
|
@ -134,7 +134,12 @@ function classroom.get_students_by_selector(selector)
|
|||
elseif selector:sub(1, 6) == "group:" then
|
||||
return classroom.get_group_students(selector:sub(7))
|
||||
elseif selector:sub(1, 5) == "user:" then
|
||||
return { selector:sub(6) }
|
||||
local pname = selector:sub(6)
|
||||
if classroom.get_player_by_name(pname) then
|
||||
return { pname }
|
||||
else
|
||||
return {}
|
||||
end
|
||||
else
|
||||
return {}
|
||||
end
|
||||
|
|
|
@ -37,6 +37,10 @@ local function get_formspec(player, context)
|
|||
return "label[0,0;" .. FS"Access denied" .. "]"
|
||||
end
|
||||
|
||||
if context.selected_student and not minetest.get_player_by_name(context.selected_student) then
|
||||
context.selected_student = nil
|
||||
end
|
||||
|
||||
local function button(def)
|
||||
local x = assert(def.x)
|
||||
local y = assert(def.y)
|
||||
|
|
Loading…
Reference in New Issue