How to get a user's profile picture URL?
The code is OK, but you have to check if the field is not empty:

if ($user = \Drupal\user\Entity\User::load(\Drupal::currentUser()-&gt;id())) {
  if (!$user-&gt;user_picture-&gt;isEmpty()) {
    $picture = $user-&gt;user_picture-&gt;view('large')
  }
  else {
    $picture = // get default picture
  }
}


In Drupal 8 don't use render service. The new template system does this automatically.