From de6e2e0e35f2f14390ef1d7ccdb0d7bc1acce2f8 Mon Sep 17 00:00:00 2001 From: Niklp Date: Fri, 19 Apr 2024 15:41:56 +0200 Subject: [PATCH] Fix nil crash when calling `unifieddyes.on_dig()` w/o PlayerRef (#21) --- api.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api.lua b/api.lua index ba5b66b..01a182a 100644 --- a/api.lua +++ b/api.lua @@ -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()