Squelch leak found by LSan by handling missing switch case.

Also, use the enum type in the switch so this doesn't happen again.

PR19523