diff --git a/auto_entityqueue.module b/auto_entityqueue.module
index c570ddb72fbe11c39da0ec325d9486cff3f417a9..80489a4a39bd931b9bcb5965eaf4faf4b789edac 100755
--- a/auto_entityqueue.module
+++ b/auto_entityqueue.module
@@ -129,10 +129,12 @@ function auto_entityqueue_get_queues_by_type_and_bundle(string $type, string $bu
   foreach ($queues as $queue) {
     $entity_settings = $queue->getEntitySettings();
     // Check bundle, if queue is enabled and if auto add is enabled.
-    if (in_array($bundle, $entity_settings['handler_settings']['target_bundles'])
-      && (isset($entity_settings['handler_settings']['auto_entityqueue']['auto_add'])
-      && $entity_settings['handler_settings']['auto_entityqueue']['auto_add'])
-      && $queue->status()
+    if (isset($entity_settings['handler_settings']['target_bundles'])
+      && is_array($entity_settings['handler_settings']['target_bundles'])
+      && in_array($bundle, $entity_settings['handler_settings']['target_bundles']) // Check bundle.
+      && isset($entity_settings['handler_settings']['auto_entityqueue']['auto_add'])
+      && $entity_settings['handler_settings']['auto_entityqueue']['auto_add'] // Check if auto add is enabled.
+      && $queue->status() // Check if queue is enabled.
     ) {
       $target_queues[] = $queue;
     }