Index: program/include/rcube_imap_cache.php
===================================================================
--- program/include/rcube_imap_cache.php	(revision 799e1201459b1ee6422d2725b502376b34950f23)
+++ program/include/rcube_imap_cache.php	(revision 63b9ff12d2573513c59e347d70de494d2c67a4ce)
@@ -1109,8 +1109,10 @@
     {
         foreach ((array)$data as $key => $val) {
-            $children[$key] = !empty($val);
-            $depth[$key] = $level;
-            if (!empty($val))
+            $empty          = empty($val) || !is_array($val);
+            $children[$key] = !$empty;
+            $depth[$key]    = $level;
+            if (!$empty) {
                 $this->build_thread_data($val, $depth, $children, $level + 1);
+            }
         }
     }
