Prevent null pointer
Added whitelisting for folders