Skip to content

Commit

Permalink
Added nil checks
Browse files Browse the repository at this point in the history
  • Loading branch information
schwiti6190 committed Oct 23, 2023
1 parent e5e9d58 commit 666b90d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/ai/jobs/CpAIJob.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ function CpAIJob:applyCurrentState(vehicle, mission, farmId, isDirectStart)
if not self.cpJobParameters or not self.cpJobParameters.startPosition then
return
end

if not vehicle then
CpUtil.error("Vehicle is null!")
return
end
local x, z, _ = self.cpJobParameters.startPosition:getPosition()
local angle = self.cpJobParameters.startPosition:getAngle()

Expand Down
3 changes: 3 additions & 0 deletions scripts/gui/CourseDisplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ end

--- Updates changes from ix or ix-1 onwards.
function SimpleCourseDisplay:updateChanges(ix)
if not self.course then
return
end
for i = #self.signs, self.course:getNumberOfWaypoints() + 1, -1 do
self.signs[i]:delete()
table.remove(self.signs, i)
Expand Down

0 comments on commit 666b90d

Please sign in to comment.