diff --git a/app/Http/Requests/InvoiceRequest.php b/app/Http/Requests/InvoiceRequest.php index 885208160fde..06406ea97b35 100644 --- a/app/Http/Requests/InvoiceRequest.php +++ b/app/Http/Requests/InvoiceRequest.php @@ -46,7 +46,9 @@ class InvoiceRequest extends EntityRequest if(request()->is('quotes/*') && request()->isMethod('get') && !$this->user()->can('view', ENTITY_QUOTE)) return false; - HistoryUtils::trackViewed($invoice); + if ($invoice) { + HistoryUtils::trackViewed($invoice); + } return true; } diff --git a/app/Libraries/HistoryUtils.php b/app/Libraries/HistoryUtils.php index e4d907891ce0..a9e6c68e9602 100644 --- a/app/Libraries/HistoryUtils.php +++ b/app/Libraries/HistoryUtils.php @@ -106,10 +106,6 @@ class HistoryUtils public static function trackViewed(EntityModel $entity) { - if (! $entity) { - return; - } - $entityType = $entity->getEntityType(); $trackedTypes = [ ENTITY_CLIENT,