Impossible to access an attribute ("avatar") on a null variable

hi i am facing this following error:

.Impossible to access an attribute (“avatar”) on a null variable

  • Exception
  • Logs 1
  • Stack Trace

Twig\Error\RuntimeError

in \ vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/Resources/views/AdminUser/_avatarImage.html.twig (line 1)

  1. {% if app.user.avatar is not empty and app.user.avatar.path is not empty %}
  2. {% set path = app.user.avatar.path|imagine_filter('sylius_admin_admin_user_avatar_thumbnail') %}
  3. {% else %}
  4. {% set path = '//placehold.it/50x50' %}
  5. {% endif %}

when i want to add a new standard product

please can ou help me solve this problème

hello, i’ve got the same issue when i want create new route to my entity in routes.yaml

I had this issue because i was extending a template with {% extends ‘@SyliusAdmin/layout.html.twig’ %}

so it was a template layout inside another template layout and that was the problem

hope it helps!

Hi @aratinau how do you solve this issue?, i’m facing the same problem.

Hello, I simply remove the extends and other blocks of the template and it worked!

Thanks, i started removing configurations and see that some vars wasn’t sending the corrects values and that was causing errors, the impossible to access an attribute… was becasuse other things stopped to work firstly.

Thanks.