Skip to content

A free open source IT asset/license management system

Add guard clause to obtain the default ID of imported asset's status label

Ivan Nieto Vivanco67e47a7d8b44
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)