Null check related to Pull Request #100.

We can't call val.GetType() if it's null.  This passes in tests (and was previously breaking).