Skip to content

Commit b5c01d5

Browse files
committed
GetTable can return nil at undos
1 parent 5be899d commit b5c01d5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lua/cfw/classes/contraption_sv.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ do -- Contraption getters and setters
3030
-- for a week or so, then remove it entirely. Use CFW_GetContraption as its replacement which is properly namespaced.
3131
-- This function has caused headaches in other codebases (wiremod's cam controllers for example) and should've always been namedspaced...
3232

33-
function ENT:GetContraption()
34-
return Entity_GetTable(self)._contraption
35-
end
3633

3734
function ENT:CFW_GetContraption()
38-
return Entity_GetTable(self)._contraption
35+
local SelfTbl = Entity_GetTable(self)
36+
if not SelfTbl then return nil end
37+
return SelfTbl._contraption
3938
end
39+
40+
ENT.GetContraption = ENT.CFW_GetContraption
4041
end
4142

4243
do -- Class def

0 commit comments

Comments
 (0)