A free open source IT asset/license management system
Move the early return to the controller instead of the Label model
Ivan Nieto Vivanco91b1cc7121e1
diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.phpindex a744db5788..932176286f 100644--- a/app/Http/Controllers/Assets/BulkAssetsController.php+++ b/app/Http/Controllers/Assets/BulkAssetsController.php@@ -58,8 +58,14 @@ class BulkAssetsController extends Controllerswitch ($request->input('bulk_actions')) {case 'labels':$this->authorize('view', Asset::class);+ $assets_found = Asset::find($asset_ids);++ if ($assets_found->isEmpty()){+ return redirect()->back();+ }+return (new Label)- ->with('assets', Asset::find($asset_ids))+ ->with('assets', $assets_found)->with('settings', Setting::getSettings())->with('bulkedit', true)->with('count', 0);diff --git a/app/View/Label.php b/app/View/Label.phpindex bbba1605b7..d581548eb3 100644--- a/app/View/Label.php+++ b/app/View/Label.php@@ -39,10 +39,6 @@ class Label implements View$assets = $this->data->get('assets');$offset = $this->data->get('offset');$template = $this->data->get('template');-- if ($assets->isEmpty()){- return redirect()->back();- }// If disabled, pass to legacy viewif ((!$settings->label2_enable) && (!$template)) {