From 715da63581af8202d1dddf931b80771cdde28dde Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 24 Oct 2017 16:53:46 -0700 Subject: [PATCH] Check that model name exists before trying to display it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I don’t know why this would ever trigger, but a user in Gitter complained earlier today, so… ¯\_(ツ)_/¯ --- app/Models/Asset.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 324034992c..a1dc0bd93a 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -184,7 +184,7 @@ class Asset extends Depreciable } else { $user_name = "Unassigned"; } - return $this->asset_tag . ' - ' . $this->name . ' (' . $user_name . ') ' . $this->model->name; + return $this->asset_tag . ' - ' . $this->name . ' (' . $user_name . ') ' . ($this->model) ? $this->model->name: ''; } public function validationRules($id = '0')