]> git.mxchange.org Git - friendica.git/commitdiff
Check for user array key before using it in include/conversation
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 3 Sep 2021 17:09:06 +0000 (13:09 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 3 Sep 2021 17:11:14 +0000 (13:11 -0400)
- Address https://github.com/friendica/friendica/issues/10473#issuecomment-905752992

include/conversation.php

index 1f337859b50c0bad9543a00280694bba4465d753..352060d7f246f17a88ea8eedc1811a07a4a192a2 100644 (file)
@@ -1068,11 +1068,14 @@ function format_activity(array $links, $verb, $id) {
 
 function status_editor(App $a, array $x = [], $notes_cid = 0, $popup = false)
 {
+       $user = User::getById($a->getLoggedInUserId(), ['uid', 'nickname', 'allow_location', 'default-location']);
+       if (empty($user['uid'])) {
+               return '';
+       }
+
        DI::profiler()->startRecording('rendering');
        $o = '';
 
-       $user = User::getById($a->getLoggedInUserId(), ['uid', 'nickname', 'allow_location', 'default-location']);
-
        $x['allow_location']   = $x['allow_location']   ?? $user['allow_location'];
        $x['default_location'] = $x['default_location'] ?? $user['default-location'];
        $x['nickname']         = $x['nickname']         ?? $user['nickname'];