This looks to be the likeliest culprit. The question I'd have here is what is the value of type? In your switch statement, it only retrieves this value if it's CRType.CR5. If it's not that type, then it doesn't look like you're returning anything.
I was brought up to respect my elders. I don't respect many people nowadays.