GUAC-1078: Only traverse child connection groups if defined.

This commit is contained in:
Michael Jumper
2015-02-18 21:23:56 -08:00
parent 7b32adad97
commit 7d65b4a024

View File

@@ -62,13 +62,22 @@ angular.module('manage').directive('locationChooser', [function locationChooser(
*/
var connectionGroups = {};
/**
* Recursively traverses the given connection group and all
* children, storing each encountered connection group within the
* connectionGroups map by its identifier.
*
* @param {GroupListItem} group
* The connection group to traverse.
*/
var mapConnectionGroups = function mapConnectionGroups(group) {
// Map given group
connectionGroups[group.identifier] = group;
// Map all child groups
group.childConnectionGroups.forEach(mapConnectionGroups);
if (group.childConnectionGroups)
group.childConnectionGroups.forEach(mapConnectionGroups);
};