Spawner: Fix issue when "npcs" table is not present in restore_plotmarkers.

This commit is contained in:
Hector Franqui 2017-09-01 18:27:17 -04:00
parent fe5a155177
commit 8e5d6d03f4

View File

@ -900,6 +900,7 @@ minetest.register_chatcommand("restore_plotmarkers", {
local infotext = meta:get_string("infotext")
local npcs = minetest.deserialize(meta:get_string("npcs"))
-- Restore workplaces to original status
if npcs then
for i = 1, #npcs do
if npcs[i].workplace then
-- Remove work data
@ -907,6 +908,7 @@ minetest.register_chatcommand("restore_plotmarkers", {
workplace_meta:set_string("work_data", nil)
end
end
end
-- Set metadata
meta = minetest.get_meta(nodes[i])
meta:set_string("village_id", village_id)