Skip to content

Commit f273832

Browse files
author
Peter Vaiko
committed
fix: check CpUtil.getName parameter
Looks like this function is called with a number in place of the vehicle during the game load sometime. Since this is called every time we are logging the vehicle's name, we have no idea which is the bad call. Add a check and print the callstack so we can identify the location. This will also mask the error, so if there is no other problem, people will not report it, and we'll never find out...
1 parent 97ae250 commit f273832

1 file changed

Lines changed: 4 additions & 0 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

0 commit comments

Comments
 (0)