Do not execute hooks on empty projects, fixes #6108