mirror of
https://github.com/fortressforever/fortressforever-scripts.git
synced 2025-02-07 00:11:42 +00:00
Don't crash if class_info() is called on non-luabind objects
* See 2c6c9054e3
This commit is contained in:
parent
5d8f3cd3ab
commit
e5e5e1735b
1 changed files with 14 additions and 0 deletions
|
@ -48,6 +48,20 @@ function baseclass:new (o)
|
|||
end
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- make luabind's class_info function safer
|
||||
-- (don't crash if class_info() is called on non-luabind objects)
|
||||
-----------------------------------------------------------------------------
|
||||
local class_info_base = class_info
|
||||
class_info = function(obj)
|
||||
local obj_type = type(obj)
|
||||
if obj_type == "userdata" and getmetatable(obj).__luabind_class then
|
||||
return class_info_base(obj)
|
||||
end
|
||||
return {}
|
||||
end
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- reset everything
|
||||
-----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue