A free open source IT asset/license management system
Only gtry to delete the file if a record is found in the log
snipe18db0a50f10d
diff --git a/app/Http/Controllers/LicensesController.php b/app/Http/Controllers/LicensesController.phpindex 49008093ba..2a40c13825 100755--- a/app/Http/Controllers/LicensesController.php+++ b/app/Http/Controllers/LicensesController.php@@ -548,18 +548,21 @@ class LicensesController extends Controllerif ($license) {$this->authorize('edit', $license);$log = Actionlog::find($fileId);- $full_filename = $destinationPath.'/'.$log->filename;- if (file_exists($full_filename)) {- unlink($destinationPath.'/'.$log->filename);+ if ($log) {+ $full_filename = $destinationPath.'/'.$log->filename;+ if (file_exists($full_filename)) {+ unlink($destinationPath.'/'.$log->filename);+ }+ $log->delete();+ return redirect()->back()->with('success', trans('admin/licenses/message.deletefile.success'));}- $log->delete();- return redirect()->back()->with('success', trans('admin/licenses/message.deletefile.success'));++ return redirect()->back()->with('error', 'Could not locate that file.');+}- // Prepare the error message- $error = trans('admin/licenses/message.does_not_exist', compact('id'));// Redirect to the licence management page- return redirect()->route('licenses.index')->with('error', $error);+ return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist', compact('id')));}