diff --git a/product/ERP5Type/patches/WorkflowTool.py b/product/ERP5Type/patches/WorkflowTool.py
index 78b60d090e672a5ba444f7baf8c189fdfbd7c82f..699687ce84cbf806f9ff0ee6da2f24b3aae9152b 100644
--- a/product/ERP5Type/patches/WorkflowTool.py
+++ b/product/ERP5Type/patches/WorkflowTool.py
@@ -169,8 +169,8 @@ def groupWorklistListByCondition(worklist_dict, acceptable_key_dict, getSecurity
               '%s filters on variable %s which is not available in '\
               'catalog. Its value will not be checked.' % \
               (worklist_id, workflow_id, criterion_id))
-      if len(valid_criterion_dict):
-        worklist_set_dict_key = [x for x in valid_criterion_dict.keys() if x != WORKLIST_METADATA_KEY]
+      worklist_set_dict_key = [x for x in valid_criterion_dict.keys() if x != WORKLIST_METADATA_KEY]
+      if len(worklist_set_dict_key):
         worklist_set_dict_key.sort()
         worklist_set_dict_key = tuple(worklist_set_dict_key)
         if worklist_set_dict_key not in worklist_set_dict: