This was answered ages ago and probably not relevant, but just in case.
When I was confronted with this issue, I simply used an if statement instead of switch, it solved the error.
It is of course a workaround and probably not the "right" solution, but in my case it was just enough.