Skip to content

Commit

Permalink
additional typecheck on mt
Browse files Browse the repository at this point in the history
  • Loading branch information
soumith committed Feb 19, 2016
1 parent 14ef272 commit e3a5571
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ function torch.isTypeOf(obj, typeSpec)

local mt = getmetatable(obj)
while mt do
if mt.__typename and matchFunc(mt.__typename, typeSpec) then
if type(mt) == 'table' and mt.__typename
and matchFunc(mt.__typename, typeSpec) then
return true
end
mt = getmetatable(mt)
Expand Down

0 comments on commit e3a5571

Please sign in to comment.