From 4ae3ed41a770f7d5ba7ec893ba304cdc9a1056eb Mon Sep 17 00:00:00 2001 From: Moritz Strohm <strohm@data-quest.de> Date: Thu, 13 Oct 2022 17:08:07 +0000 Subject: [PATCH] fixed exception in case no blubber streams could be found, closes #864 Closes #864 Merge request studip/studip!1073 --- app/controllers/blubber.php | 12 ++++++------ app/views/blubber/index.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/blubber.php b/app/controllers/blubber.php index 4341b73576e..06390970c5e 100644 --- a/app/controllers/blubber.php +++ b/app/controllers/blubber.php @@ -47,16 +47,16 @@ class BlubberController extends AuthenticatedController $this->thread = array_pop($threads); } + $this->thread_data = []; if ($this->thread) { $this->thread->markAsRead(); + $this->thread_data = $this->thread->getJSONData( + 50, + null, + Request::get("search") + ); } - $this->thread_data = $this->thread->getJSONData( - 50, - null, - Request::get("search") - ); - if (!Avatar::getAvatar($GLOBALS['user']->id)->is_customized() && !$_SESSION['already_asked_for_avatar']) { $_SESSION['already_asked_for_avatar'] = true; PageLayout::postInfo(sprintf( diff --git a/app/views/blubber/index.php b/app/views/blubber/index.php index 7392fa46638..0055f97fa0e 100644 --- a/app/views/blubber/index.php +++ b/app/views/blubber/index.php @@ -1,5 +1,5 @@ <div class="blubber_panel" - data-active_thread="<?= htmlReady($thread->getId()) ?>" + data-active_thread="<?= htmlReady(!empty($thread) ? $thread->getId() : '') ?>" data-thread_data="<?= htmlReady(json_encode($thread_data ?: ['thread_posting' => []])) ?>" data-threads_more_down="<?= htmlReady($threads_more_down) ?>" :class="waiting ? 'waiting' : ''" v-cloak> -- GitLab