diff --git a/config/vufind/HierarchyDefault.ini b/config/vufind/HierarchyDefault.ini
index b342201180ded87e1098e783611fa844fd9471e5..5c1f58595e450f7fa6251e067620a4852d791202 100644
--- a/config/vufind/HierarchyDefault.ini
+++ b/config/vufind/HierarchyDefault.ini
@@ -27,4 +27,10 @@ fullHierarchyRecordView = true
 ; Filter queries filter what kind of children are displayed in the tree
 ; Note: The hidden filters from searches.ini are applied as well
 ; Note: Only applies when treeSource = Solr
-;filterQueries[] = "-relsext.hasModel:\"DataModel\" AND -relsext.hasModel:\"ListCollection\""
\ No newline at end of file
+;filterQueries[] = "-relsext.hasModel:\"DataModel\" AND -relsext.hasModel:\"ListCollection\""
+; Check whether the hierarchy_parent_id and hierarchy_top_id records are
+; available in the index. If a referenced parent_id or top_id does not
+; exist the frontend will show HierarchyTree layout-elements but will
+; hang on acutally building the HierarchyTree.
+; (default = true)
+checkAvailability = true
\ No newline at end of file
diff --git a/config/vufind/HierarchyFlat.ini b/config/vufind/HierarchyFlat.ini
index eb7b46355284df6e556d93d76dda479cfda1be10..79de9e358dfa0d4238a237da1afdc561651bc73f 100644
--- a/config/vufind/HierarchyFlat.ini
+++ b/config/vufind/HierarchyFlat.ini
@@ -24,3 +24,9 @@ show = false
 ; (true = show full hierarchy, false = only show path to current selected node,
 ; default = true)
 ;fullHierarchyRecordView = true
+; Check whether the hierarchy_parent_id and hierarchy_top_id records are
+; available in the index. If a referenced parent_id or top_id does not
+; exist the frontend will show HierarchyTree layout-elements but will
+; hang on acutally building the HierarchyTree.
+; (default = true)
+checkAvailability = true
\ No newline at end of file
diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Solr.php b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Solr.php
index 87e25f6e0c7e63093fff6c3738ba23b88d3d9ca1..058e89e08b1ab5dd8b48e4b2744c4e975c6fa633 100644
--- a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Solr.php
+++ b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/Solr.php
@@ -228,6 +228,20 @@ class Solr extends AbstractBase
      */
     public function supports($id)
     {
+        $settings = $this->hierarchyDriver->getTreeSettings();
+
+        if (isset($settings['checkAvailability']) && $settings['checkAvailability']==1) {
+            $query = new Query(
+                'id:"' . addcslashes($id, '"') . '"'
+            );
+            $results = $this->searchService->search(
+                'Solr', $query, 0, 10000,
+                new ParamBag(array('fq' => $this->filters, 'hl' => 'false'))
+            );
+            if ($results->getTotal() < 1) {
+                return false;
+            }
+        }
         // Assume all IDs are supported.
         return true;
     }