diff --git a/scripts/ai/jobs/CpAIJob.lua b/scripts/ai/jobs/CpAIJob.lua index acb9dbc81..017375fec 100644 --- a/scripts/ai/jobs/CpAIJob.lua +++ b/scripts/ai/jobs/CpAIJob.lua @@ -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() diff --git a/scripts/gui/CourseDisplay.lua b/scripts/gui/CourseDisplay.lua index 9a428ad5f..742c86f5a 100644 --- a/scripts/gui/CourseDisplay.lua +++ b/scripts/gui/CourseDisplay.lua @@ -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)