From 67e47a7d8b44ed4575ae3f10044160c1c8cd775d Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Thu, 22 Jun 2023 13:53:58 -0600 Subject: [PATCH] Add guard clause to obtain the default ID of imported asset's status label --- app/Importer/AssetImporter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.php index e8da1e06b4..be19455618 100644 --- a/app/Importer/AssetImporter.php +++ b/app/Importer/AssetImporter.php @@ -12,7 +12,10 @@ class AssetImporter extends ItemImporter public function __construct($filename) { parent::__construct($filename); - $this->defaultStatusLabelId = Statuslabel::first()->id; + + if (!is_null(Statuslabel::first())) { + $this->defaultStatusLabelId = Statuslabel::first()->id; + } } protected function handle($row)