From b52b8067076acf87a263e0976c9aa19e589a7125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Buchmann?= Date: Sat, 9 Nov 2024 20:02:18 +0100 Subject: [PATCH] Make sure the target exists --- scripts/main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/main.lua b/scripts/main.lua index 2237a5c..44bbb1c 100644 --- a/scripts/main.lua +++ b/scripts/main.lua @@ -203,7 +203,7 @@ end -- Add helper functions to UnloadTrigger objects function UnloadTrigger:getFillUnitFillLevelTFL(fillUnitIndex, fillTypeIndex, farmId) - if self.target.getFillLevel ~= nil then + if self.target ~= nil and self.target.getFillLevel ~= nil then local conversion = self.fillTypeConversions[fillTypeIndex] if conversion ~= nil then @@ -217,7 +217,7 @@ function UnloadTrigger:getFillUnitFillLevelTFL(fillUnitIndex, fillTypeIndex, far end function UnloadTrigger:getFillUnitCapacityTFL(fillUnitIndex, fillTypeIndex, farmId) - if self.target.getCapacity ~= nil then + if self.target ~= nil and self.target.getCapacity ~= nil then local conversion = self.fillTypeConversions[fillTypeIndex] if conversion ~= nil then