Avoid crash in skybox.set.

For some reason, `number` was invalid. It was likely passed from
a formspec. Avoid this part of the crash entirely.
This commit is contained in:
Auke Kok 2019-09-12 10:59:59 -07:00
parent 6f82f9a8b8
commit dd2b25a379

View File

@ -37,10 +37,16 @@ local skies = {
skybox = {}
skybox.set = function(player, number)
if not player then
return
end
if number == 0 then
skybox.clear(player)
else
local sky = skies[number]
if not sky then
return
end
player:override_day_night_ratio(sky[3])
player:set_sky(sky[2], "skybox", {
sky[1] .. "Up.jpg",
@ -55,6 +61,9 @@ skybox.set = function(player, number)
end
skybox.clear = function(player)
if not player then
return
end
player:override_day_night_ratio(nil)
player:set_sky("white", "regular")
player:set_clouds({