Moodle should check that a theme exists, and if not, it should give an error message and revert to a standard theme.
If a theme does not exist, the results are major for the user as it is very difficult to navigate to a preference for a course or of the user to change to a standard theme even if they knew that was the problem.
This can happen if one is expermenting with alternate themes and then removes them without reverting all courses or user themes or if one migrates to a different server or a new Moodle installation.