From cb5b691ec1dfa10780c59853f1bef806b2d28054 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 19 Feb 2024 15:34:57 +0000 Subject: [PATCH] Check that the model exists before trying to access properties Signed-off-by: snipe --- app/Http/Controllers/ReportsController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 162469bcd2..d03261bc29 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -296,8 +296,8 @@ class ReportsController extends Controller e($actionlog->itemType()), ($actionlog->itemType() == 'user') ? $actionlog->filename : $item_name, ($actionlog->item) ? $actionlog->item->serial : null, - ($actionlog->item->model) ? htmlspecialchars($actionlog->item->model->name, ENT_NOQUOTES) : null, - ($actionlog->item->model) ? $actionlog->item->model->model_number : null, + (($actionlog->item) && ($actionlog->item->model)) ? htmlspecialchars($actionlog->item->model->name, ENT_NOQUOTES) : null, + (($actionlog->item) && ($actionlog->item->model)) ? $actionlog->item->model->model_number : null, $target_name, ($actionlog->note) ? e($actionlog->note) : '', $actionlog->log_meta,