From 979493ed64fd4c996f55d2e9d35055cef937e6ce Mon Sep 17 00:00:00 2001 From: Treer Date: Tue, 26 Jan 2021 19:49:10 +1100 Subject: [PATCH] Fix nil reference The error below was reported, so handle the existence of a mod called "bucket" which doesn't have any liquids field: Runtime error from mod 'nether' in callback on_mods_loaded(): /mods/environment/nether/nodes.lua:378: attempt to index field 'liquids' (a nil value) stack traceback: /mods/environment/nether/nodes.lua:378: in function /mods/environment/nether/nodes.lua:373 /minetest/builtin/game/register.lua:429: in function /minetest/builtin/game/register.lua:413 --- nodes.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes.lua b/nodes.lua index dea7070..afb6fb4 100644 --- a/nodes.lua +++ b/nodes.lua @@ -374,7 +374,7 @@ minetest.register_on_mods_loaded(function() -- register a bucket of Lava-sea source - but make it just the same bucket as default lava. -- (by doing this in register_on_mods_loaded we don't need to declare a soft dependency) - if minetest.get_modpath("bucket") and minetest.global_exists("bucket") then + if minetest.get_modpath("bucket") and minetest.global_exists("bucket") and type(bucket.liquids) == "table" then local lava_bucket = bucket.liquids["default:lava_source"] if lava_bucket ~= nil then local lavasea_bucket = {}