attributes cannot be null here since you have already checked if it has attributes in line 189