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
This commit is contained in:
Treer 2021-01-26 19:49:10 +11:00
parent 1fbab7451e
commit 979493ed64
1 changed files with 1 additions and 1 deletions

View File

@ -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 = {}