[PATCH] fix for switch(bad_type) {...} segfault