Creative: Fix crash when turning on creative in-game

This commit is contained in:
Rui 2016-11-05 11:58:13 +09:00 committed by paramat
parent c824d69182
commit 5868274b00

View File

@ -173,6 +173,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local player_name = player:get_player_name() local player_name = player:get_player_name()
local inv = player_inventory[player_name] local inv = player_inventory[player_name]
-- If creative is turned on mid game
if not inv then
creative.init_creative_inventory(player)
creative.set_creative_formspec(player, 0)
return
end
if fields.quit then if fields.quit then
if inv.tab_id == 1 then if inv.tab_id == 1 then
creative.set_crafting_formspec(player) creative.set_crafting_formspec(player)