I would prefer the special check. Also, if the problem is only when the type is null, the solution should check specifically for type == null, and leave it alone otherwise.