From 62ad932aa75c199fcda2faf02098bf944a685bdb Mon Sep 17 00:00:00 2001 From: Tsvetan Koshutanski Date: Tue, 23 Mar 2021 15:12:42 +0200 Subject: [PATCH] Properly check if variable is set before referencing it For PHP 7.4 --- src/mibew/libs/chat.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mibew/libs/chat.php b/src/mibew/libs/chat.php index 061b9993..b390096e 100644 --- a/src/mibew/libs/chat.php +++ b/src/mibew/libs/chat.php @@ -446,9 +446,10 @@ function setup_chatview_for_user( // Set default operator's avatar $operator = operator_by_id($thread->agentId); - $data['chat']['avatar'] = $operator['vcavatar'] - ? $asset_url_generator->generate($operator['vcavatar']) - : ''; + $data['chat']['avatar'] = ''; + if (!empty($operator['vcavatar'])) { + $data['chat']['avatar'] = $asset_url_generator->generate($operator['vcavatar']); + } return $data;