If you create an object with attributes that are empty strings, they'll get indexed.
So:
Will result in an item in your index with attribute = ''.
This is very easy to fix since there's already a check to make sure that attributes aren't None. All that needs to happen is for the line to also say, and a != ''.