->getAttributeCode() is null on products as well.  Always use getName().