Added a condition to avoid issues with the call to \Drupal::request()->get...