$wp_admin_bar->user->blogs is not always aviable added protection before use in ultimate-brand

.../ultimate-branding-files/modules/favicons.php   | 22 ++++++++++++

1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/plugins/ultimate-branding/ultimate-branding-files/modules/favicons.php b/plugins/ultimate-branding/ultimate-branding-files/modules/favicons.php
index 12c5de9..1a17c5d 100644
--- a/plugins/ultimate-branding/ultimate-branding-files/modules/favicons.php
+++ b/plugins/ultimate-branding/ultimate-branding-files/modules/favicons.php
@@ -260,19 +260,21 @@ class ub_favicons {
*/
function change_blavatar_icon() {
global $wp_admin_bar;
+ if( isset( $wp_admin_bar->user->blogs ) ) {
+ foreach ((array) $wp_admin_bar->user->blogs as $blog) {

- foreach ((array) $wp_admin_bar->user->blogs as $blog) {
+ $blavatar = '<img src="' . self::get_favicon( $blog->userblog_id ) . '" alt="' . esc_attr__('Blavatar') . '" width="16" height="16" class="blavatar"/>';
+ $blogname = empty($blog->blogname) ? $blog->domain : $blog->blogname;

- $blavatar = '<img src="' . self::get_favicon( $blog->userblog_id ) . '" alt="' . esc_attr__('Blavatar') . '" width="16" height="16" class="blavatar"/>';
- $blogname = empty($blog->blogname) ? $blog->domain : $blog->blogname;
+ $wp_admin_bar->add_menu(array(
+ 'parent' => 'my-sites-list',
+ 'id' => 'blog-' . $blog->userblog_id,
+ 'title' => $blavatar . $blogname,
+ 'href' => get_admin_url($blog->userblog_id),
+ ));
+ }
+ }

- $wp_admin_bar->add_menu(array(
- 'parent' => 'my-sites-list',
- 'id' => 'blog-' . $blog->userblog_id,
- 'title' => $blavatar . $blogname,
- 'href' => get_admin_url($blog->userblog_id),
- ));
- }
}

/**