Improve invalid reflect value handling.

It was previously possible for an invalid reflect value to lead to a panic
in certain obscure cases.  Rather than adding multiple checks for the
invalid reflect value, handle invalid reflect values immediately.