Sema: Don't crash when trying to emit a warning for a duplicate value in an invalid enum.

Fixes PR15693. A null check on a pointer returned from cast<> is a very dubious
construct, do we have a checker for this somewhere?