Add a safety check for non-rtti.
Merge pull request #2169 from unknownbrackets/rtti

Add a safety check for non-rtti