From 220f94faeebe371051cb9fe5055d56377199e87a Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 6 May 2022 14:10:47 -0700 Subject: [PATCH] Check that the session key exists Signed-off-by: snipe --- app/Http/Controllers/Assets/BulkAssetsController.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.php index 0f13b1e68f..4aede02a81 100644 --- a/app/Http/Controllers/Assets/BulkAssetsController.php +++ b/app/Http/Controllers/Assets/BulkAssetsController.php @@ -83,7 +83,11 @@ class BulkAssetsController extends Controller $this->authorize('update', Asset::class); // Get the back url from the session and then destroy the session - $bulk_back_url = $request->session()->pull('bulk_back_url'); + $bulk_back_url = route('hardware'); + if ($request->session()->has('bulk_back_url')) { + $bulk_back_url = $request->session()->pull('bulk_back_url'); + } + if (! $request->filled('ids') || count($request->input('ids')) <= 0) { return redirect($bulk_back_url)->with('error', trans('admin/hardware/message.update.no_assets_selected')); @@ -200,8 +204,10 @@ class BulkAssetsController extends Controller { $this->authorize('delete', Asset::class); - // Get the back url from the session and then destroy the session - $bulk_back_url = $request->session()->pull('bulk_back_url'); + $bulk_back_url = route('hardware'); + if ($request->session()->has('bulk_back_url')) { + $bulk_back_url = $request->session()->pull('bulk_back_url'); + } if ($request->filled('ids')) { $assets = Asset::find($request->get('ids'));