diff --git a/mobile_tools.module b/mobile_tools.module index 8a3d808..e0265e6 100755 --- a/mobile_tools.module +++ b/mobile_tools.module @@ -132,10 +132,18 @@ function mobile_tools_init(){ // Get current device group for comparison $active_device_group = mobile_tools_get_active_device_group(); + $tmp = array(); + // Sort into buckets by weight foreach($device_groups as $device_group) { $tmp[$device_group->weight][$device_group->dgid] = $device_group; } + + // no device groups then return. + if (!is_array($tmp) || sizeof($tmp == 0)) { + return; + } + sort($tmp, SORT_NUMERIC); $device_groups = $tmp;