Fix: Check for empty lists before evaluating dynamic attributes.