Fixing php error for empty directories

When exist an empty directory, this make an error on php,and shows a ugly error and move editor down