Avoid dereference of null TClass pointer
Merge pull request #4460 from wmtan/AllowForNonClassType

Avoid dereference of null TClass pointer