Fix a crash with an empty cacheDirectory