diff --git a/purge_queuer_url.drush.inc b/purge_queuer_url.drush.inc
index 8d93cb8..3366c72 100644
--- a/purge_queuer_url.drush.inc
+++ b/purge_queuer_url.drush.inc
@@ -14,5 +14,7 @@ function purge_queuer_url_drush_sql_sync_sanitize($source) {
   drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL);
 
   // Clear the traffic registry.
-  \Drupal::service('purge_queuer_url.registry')->clear();
+  if (\Drupal::hasService('purge_queuer_url.registry')) {
+    \Drupal::service('purge_queuer_url.registry')->clear();
+  }
 }
