Fixing php error for empty directories

When a theme have a empty directory, this make an error.

Making a validation for no empty $files var