From e122ee827c57880fd03ca767b5ea57127242aa46 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 10 May 2023 11:06:54 +0200 Subject: [PATCH] fix nullable source --- app/Models/Application.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Models/Application.php b/app/Models/Application.php index 9306c65ff..422e4abd7 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -47,9 +47,15 @@ public function publishDirectory(): Attribute public function gitLocation(): Attribute { return Attribute::make( - get: fn () => is_null($this->git_commit_sha) - ? "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_branch}" - : "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_commit_sha}" + get: function () { + if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) { + if (is_null($this->git_commit_sha)) { + return "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_branch}"; + } else { + return "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_commit_sha}"; + } + } + } ); }