From a4bbd1cd2c03fa3a64254ebc1dd17205ab57a5fe Mon Sep 17 00:00:00 2001 From: Tobias Dammers Date: Tue, 19 Oct 2021 17:03:36 +0200 Subject: [PATCH] Bugfix: ignore tanks with nil capacity --- addon-main.nas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addon-main.nas b/addon-main.nas index ae08aa9..dda28b3 100644 --- a/addon-main.nas +++ b/addon-main.nas @@ -232,8 +232,8 @@ var importFOB = func (ofp) { amount = math.min(amount, maxAmount); } var tankCapacity = - tankNode.getNode('capacity-m3').getValue() * - tankNode.getNode('density-kgpm3').getValue(); + (tankNode.getNode('capacity-m3').getValue() or 0) * + (tankNode.getNode('density-kgpm3').getValue() or 0); amount = math.min(amount, tankCapacity); logprint(3, sprintf("Allocating %1.1f/%1.1f kg to %s", amount, unallocated, tankName)); tankNode.getNode('level-kg').setValue(amount);