Ensure that label key exists before attempting removal

This commit is contained in:
guerler
2016-11-04 18:21:48 -04:00
parent 7456b1f921
commit 4d623a4d5a
+1 -1
View File
@@ -1020,7 +1020,7 @@ def _filter_for_panel( item, item_type, filters, context ):
elif section_item_type == panel_item_types.LABEL:
# If there is a label and it does not have tools,
# remove it.
if ( cur_label_key and not tools_under_label ) or not _apply_filter( section_item, filters[ 'label' ] ):
if cur_label_key and ( not tools_under_label or not _apply_filter( section_item, filters[ 'label' ] ) ):
del filtered_elems[ cur_label_key ]
# Reset attributes for new label.