TypeError: argument of type 'NoneType' is not iterable

I have used the following code and it works:

# nach Preis sortiert:
 ***
{% for entity in expand('group.alle_tankstellen_sensors') | sort(attribute='state') |  map(attribute='entity_id') | map('string') | list %} 

{% if 'ARAL' in state_attr(entity, 'brand') %} 
  ![iamge](/local/img/aral.png)
{% elif 'TotalEnergies' in state_attr(entity, 'brand') %} 
  ![iamge](/local/img/total.png)
{% elif 'BFT' in state_attr(entity, 'brand') %} 
  ![iamge](/local/img/bft.png)
{% elif 'JET' in state_attr(entity, 'brand') %} 
  ![iamge](/local/img/jet.png)
{% elif 'Esso' in state_attr(entity, 'brand') %} 
  ![iamge](/local/img/esso.png)
{% elif 'Shell' in state_attr(entity, 'brand') %} 
  ![iamge](/local/img/shell.png)
{% endif %}

{{ state_attr(entity, 'station_name') }}
{{ state_attr(entity, 'street') }} {{ state_attr(entity, 'house_number') }}
{{ state_attr(entity, 'postcode') }} {{ state_attr(entity, 'city') }}

  ## Preis: {{ states(entity)  | replace(".",",") }} €

***
{% endfor %}

But after an Home Assistant Update i get the following Error:
TypeError: argument of type ‘NoneType’ is not iterable

What I must change in my code, to fix the error?

Without changing anything, the error message disappeared and everything is displayed correctly again