Fix server crash when players dig unknown nodes

Digging unknown nodes crashes the Clamity Minetest server, which
runs modified Minetest: https://github.com/ClamityAnarchy/minetest
Crashes did occur with commit d5434bf008 of that Minetest version.

This commit makes unknown nodes explicitly not harvestable.
This commit is contained in:
cora 2021-06-15 01:13:24 +02:00 committed by Elias Fleckenstein
parent fb01e61946
commit c558e30ea5
1 changed files with 4 additions and 0 deletions

View File

@ -207,6 +207,10 @@ end
function mcl_autogroup.can_harvest(nodename, toolname) function mcl_autogroup.can_harvest(nodename, toolname)
local ndef = minetest.registered_nodes[nodename] local ndef = minetest.registered_nodes[nodename]
if not ndef then
return false
end
if minetest.get_item_group(nodename, "dig_immediate") >= 2 then if minetest.get_item_group(nodename, "dig_immediate") >= 2 then
return true return true
end end