Hi, I just noticed this post "by chance" when I am looking for 0.17 update of this good mod.
Just happily download this mod and test. I am using Schall Tank Platoon 0.17.9 and Vehicle Wagon 2 1.2.11.
I can reproduce your bug, by having "vehicle fuel cell" in the tank grid.
The cause is "vehicle fuel cell" is a burner (consuming chemical fuel like wood, coal, solid fuel) but have NO burnt fuel inventory.
So the solution is to have validity check before.
Line 56 should be changed to:
if equipment[i].burner.burnt_result_inventory.valid then
items.grid[i].burner.burnt_result_inventory = equipment[i].burner.burnt_result_inventory.get_contents()
end
Line 119-121 (117-119?) should also be changed to:
if items.grid[i].burner.burnt_result_inventory then
for name, count in pairs(items.grid[i].burner.burnt_result_inventory) do
equipment.burner.burnt_result_inventory.insert{name = name, count = count}
end
end
I submitted the above changes to your GitHub.
There is a minor flaw (but not crash) though. The MK3 tanks (including light tank MK3, heavy tank MK3) are consuming nuclear fuel, and they have burnt fuel slots. I winched these onto the vehicle wagon, and winched them back onto the ground. The result is... those "used uranium fuel cell" disappeared from the burnt fuel slot.