diff -urN ../roundcube-thunderbird_labels-1.6.1.orig/thunderbird_labels.php ./thunderbird_labels.php --- ../roundcube-thunderbird_labels-1.6.1.orig/thunderbird_labels.php 2023-02-02 08:06:38.000000000 +0200 +++ ./thunderbird_labels.php 2023-04-13 18:56:55.998430000 +0300 @@ -427,15 +427,15 @@ { $mbox_name = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC); // appears to be the current one $uids = rcube_utils::get_input_value('_uids', rcube_utils::INPUT_GPC); - if ($uids && $mbox_name) + if ($uids && $mbox_name && isset($params['folders'][0])) { $mbox_name = $params['folders'][0]; $RCMAIL = $this->rc; # -- from here it's from check_recent.inc $data = $RCMAIL->storage->folder_data($mbox_name); - if (empty($_SESSION['list_mod_seq']) || $_SESSION['list_mod_seq'] != $data['HIGHESTMODSEQ']) { - $flags = $RCMAIL->storage->list_flags($mbox_name, explode(',', $uids), $_SESSION['list_mod_seq']); + if (empty($_SESSION['list_mod_seq']) || (isset($data['HIGHESTMODSEQ']) && $_SESSION['list_mod_seq'] != $data['HIGHESTMODSEQ'])) { + $flags = $RCMAIL->storage->list_flags($mbox_name, explode(',', $uids), (empty($_SESSION['list_mod_seq']) ? null : $_SESSION['list_mod_seq'])); foreach ($flags as $idx => $row) { $flags[$idx] = array_change_key_case(array_map('intval', $row)); }