I think this can be changed to an assertion as it is a programming error not user input validation?