Skip to content

Commit

Permalink
Fix "Call to a member function getId() on null"
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcoder87 committed Apr 25, 2018
1 parent e780aea commit d9dc24e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions application/modules/forum/controllers/Showposts.php
Expand Up @@ -68,8 +68,9 @@ public function indexAction()
$topicMapper->saveVisits($topicModel);

$userMapper = new UserMapper();
$user = null;
$userId = null;
if ($this->getUser()) {
$userId = $this->getUser()->getId();
$postMapper = new PostMapper;
$postModel = new ForumPostModel;

Expand All @@ -82,7 +83,7 @@ public function indexAction()
$postMapper->saveRead($postModel);
}
}
$user = $userMapper->getUserById($this->getUser()->getId());
$user = $userMapper->getUserById($userId);

$readAccess = [3];
if ($user) {
Expand Down

0 comments on commit d9dc24e

Please sign in to comment.