Check if path is non-nil before looking for project root