Skip to content

Commit

Permalink
Make sure the target exists
Browse files Browse the repository at this point in the history
  • Loading branch information
schliesser committed Nov 9, 2024
1 parent cdc647e commit b52b806
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b52b806

Please sign in to comment.