At the point marked "HERE!", missingClasses.length is zero, whereas prior to the assignment immediately above it, it was 2.
Apparently, there needs to be a check in here to return if missingClasses.length is zero, just as there is before missingClasses got redefined.