Fix for assigned but no longer associated label groups
authorAlexander Ebert <ebert@woltlab.com>
Mon, 23 Dec 2013 11:44:27 +0000 (12:44 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 23 Dec 2013 11:44:27 +0000 (12:44 +0100)
wcfsetup/install/files/js/WCF.Label.js

index 48a03aebab93f4e97759cb4687d8876e0d005f84..cfde218ce54d1ba1b2a0af4c9f9b8c817cb4b1fd 100644 (file)
@@ -139,13 +139,16 @@ WCF.Label.Chooser = Class.extend({
                // pre-select labels
                if ($.getLength(selectedLabelIDs)) {
                        for (var $groupID in selectedLabelIDs) {
-                               WCF.Dropdown.getDropdownMenu(this._groups[$groupID].wcfIdentify()).find('> ul > li:not(.dropdownDivider)').each($.proxy(function(index, label) {
-                                       var $label = $(label);
-                                       var $labelID = $label.data('labelID') || 0;
-                                       if ($labelID && selectedLabelIDs[$groupID] == $labelID) {
-                                               this._selectLabel($label, true);
-                                       }
-                               }, this));
+                               var $group = this._groups[$groupID];
+                               if ($group) {
+                                       WCF.Dropdown.getDropdownMenu($group.wcfIdentify()).find('> ul > li:not(.dropdownDivider)').each($.proxy(function(index, label) {
+                                               var $label = $(label);
+                                               var $labelID = $label.data('labelID') || 0;
+                                               if ($labelID && selectedLabelIDs[$groupID] == $labelID) {
+                                                       this._selectLabel($label, true);
+                                               }
+                                       }, this));
+                               }
                        }
                }