Fix for crash with malformed switch statement. Fixes #1376