Skip to content

Commit

Permalink
Handle null icon_id case
Browse files Browse the repository at this point in the history
  • Loading branch information
cl8n committed Jun 17, 2024
1 parent c0a70b9 commit 2d90599
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/Models/Forum/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,13 @@ public function isBeatmapsetPost()

public function legacyIcon(): ?LegacyIcon
{
// TODO: $this->icon_id shouldn't be null, but there are some cases
// where we make a new Post model and don't refresh it with the default
// attributes from database
if ($this->icon_id === null) {
return null;
}

return app('forum-legacy-icons')->byId($this->icon_id);
}

Expand Down

0 comments on commit 2d90599

Please sign in to comment.