Can just check if (!cur). It's simpler, faster, and (imo) looks better.