Bugfix: ignore tanks with nil capacity

This commit is contained in:
Tobias Dammers 2021-10-19 17:03:36 +02:00
parent a9fc99b947
commit a4bbd1cd2c

View File

@ -232,8 +232,8 @@ var importFOB = func (ofp) {
amount = math.min(amount, maxAmount); amount = math.min(amount, maxAmount);
} }
var tankCapacity = var tankCapacity =
tankNode.getNode('capacity-m3').getValue() * (tankNode.getNode('capacity-m3').getValue() or 0) *
tankNode.getNode('density-kgpm3').getValue(); (tankNode.getNode('density-kgpm3').getValue() or 0);
amount = math.min(amount, tankCapacity); amount = math.min(amount, tankCapacity);
logprint(3, sprintf("Allocating %1.1f/%1.1f kg to %s", amount, unallocated, tankName)); logprint(3, sprintf("Allocating %1.1f/%1.1f kg to %s", amount, unallocated, tankName));
tankNode.getNode('level-kg').setValue(amount); tankNode.getNode('level-kg').setValue(amount);