Fix nil crash when calling `unifieddyes.on_dig()` w/o PlayerRef (#21)

This commit is contained in:
Niklp 2024-04-19 15:41:56 +02:00 committed by GitHub
parent 3e45f316a3
commit de6e2e0e35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -45,10 +45,11 @@ minetest.register_on_placenode(
end
)
-- The complementary function: strip-off the color if the node being dug is still white/neutral
-- The complementary function: strip-off the color if the node being dug is still white/neutral
-- adapted from
-- https://github.com/minetest/minetest/blob/fe8d04d0b3c2e3af7c406fb6527f1b5230a30137/builtin/game/item.lua#L460-L562
local function node_dig_without_color(pos, node, digger)
if not digger then return false end
local diggername = digger:get_player_name()
local def = ItemStack(node.name):get_definition()