Fix component:serialize can return nil

This commit is contained in:
Pablo Ariel Mayobre 2020-03-15 01:04:39 -03:00
parent 78dc7ee937
commit f640258852
No known key found for this signature in database
GPG key ID: 5ACD9E6858BEB0A9

View file

@ -190,11 +190,13 @@ function Entity:serialize()
for _, component in pairs(self.__components) do
if component.__name then
local componentData = component:serialize()
componentData.__name = component.__name
if componentData ~= nil then
componentData.__name = component.__name
data[#data + 1] = componentData
end
end
end
return data
end