So I am trying to use the default image for users in a menu block if a custom one does not exist. And for it I am getting the image file uuid:
$default_image = $user->get('user_picture')->getSetting('default_image');
Then loading the file entity:
$file = Drupal::service('entity.repository')->loadEntityByUuid('file', $default_image['uuid']);
This is returning null. What am I doing wrong? And is there a better way to achieve this?