Skip to content

Commit f870258

Browse files
authored
Merge pull request #991 from Courseplay/990-loading-error-at-89-game-stays-at-that-percentage-indefinitely
fix: check CpUtil.getName parameter
2 parents 907a415 + 0990931 commit f870258

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

scripts/CpUtil.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ function CpUtil.getName(object)
118118
if object == CpUtil then
119119
return 'ERROR, calling CpUtil.getName with : !'
120120
end
121+
if type(object) ~= 'table' then
122+
printCallstack()
123+
return 'ERROR, calling CpUtil.getName with a non-table: ' .. tostring(object)
124+
end
121125
local helperName = '-'
122126
if object == object.rootVehicle then
123127
helperName = object.id

scripts/specializations/CpVehicleSettings.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,9 @@ end
433433
function CpVehicleSettings:setPipeOffset()
434434
local childVehiclesWithPipe, found = AIUtil.getAllChildVehiclesWithSpecialization(self, Pipe)
435435
if #childVehiclesWithPipe > 1 then
436-
CpUtil.infoVehicle(CpDebug.DBG_IMPLEMENTS, self, "More than one pipe found, using the first one")
436+
CpUtil.infoVehicle(self, "More than one pipe found, using the first one")
437437
for _, vehicleWithPipe in ipairs(childVehiclesWithPipe) do
438-
CpUtil.infoVehicle(CpDebug.DBG_IMPLEMENTS, self, "\t vehicle with pipe: %s", CpUtil.getName(vehicleWithPipe))
438+
CpUtil.infoVehicle(self, "\t vehicle with pipe: %s", CpUtil.getName(vehicleWithPipe))
439439
end
440440
end
441441
if self.isServer and childVehiclesWithPipe[1] ~= nil then

0 commit comments

Comments
 (0)