mirror of
https://github.com/mt-mods/unifieddyes.git
synced 2024-11-22 15:33:52 +01:00
prevent crash in setting sky color
if get color from name return nil
This commit is contained in:
parent
f59c8affc1
commit
10ab87bf65
10
init.lua
10
init.lua
@ -668,10 +668,12 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
|
|||||||
minetest.chat_send_player(player_name, "*** No node selected")
|
minetest.chat_send_player(player_name, "*** No node selected")
|
||||||
else
|
else
|
||||||
local hexcolor = unifieddyes.get_color_from_dye_name(painting_with)
|
local hexcolor = unifieddyes.get_color_from_dye_name(painting_with)
|
||||||
local r = tonumber(string.sub(hexcolor,1,2),16)
|
if hexcolor then
|
||||||
local g = tonumber(string.sub(hexcolor,3,4),16)
|
local r = tonumber(string.sub(hexcolor,1,2),16)
|
||||||
local b = tonumber(string.sub(hexcolor,5,6),16)
|
local g = tonumber(string.sub(hexcolor,3,4),16)
|
||||||
player:set_sky({r=r,g=g,b=b,a=255},"plain")
|
local b = tonumber(string.sub(hexcolor,5,6),16)
|
||||||
|
player:set_sky({r=r,g=g,b=b,a=255},"plain")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user