diff options
Diffstat (limited to 'advtrains/init.lua')
-rw-r--r-- | advtrains/init.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/advtrains/init.lua b/advtrains/init.lua index 482c33d..de72ea1 100644 --- a/advtrains/init.lua +++ b/advtrains/init.lua @@ -281,7 +281,10 @@ advtrains.avt_save = function(remove_players_from_wagons) local _,proto = advtrains.get_wagon_prototype(wdata) if proto.has_inventory then local inv=minetest.get_inventory({type="detached", name="advtrains_wgn_"..id}) - wdata.ser_inv=advtrains.serialize_inventory(inv) + if inv then -- inventory is not initialized when wagon was never loaded + -- TOOD: What happens with unloading rails when they don't find the inventory? + wdata.ser_inv=advtrains.serialize_inventory(inv) + end end -- TODO apply save-keys here too end |