Avoid NPE when classes folder is removed (#13313).

Change-Id: Ie2585998ae649f9fc32c3e2adb90e9796ac28a5c