Added nil check for object validation.

I think it'd be a good idea to eventually stick in some type checking, but this should suffice for now.