diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 6bb7aa35cf7f..bacc27f4238a 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -1021,7 +1021,12 @@ public function getAssetAcceptanceReport($deleted = false) $assetsForReport = $acceptances ->filter(function ($acceptance) { - return $acceptance->checkoutable_type == 'App\Models\Asset' && $acceptance->checkoutable->checkedOutToUser(); + $acceptance_checkoutable_flag = false; + if ($acceptance->checkoutable){ + $acceptance_checkoutable_flag = $acceptance->checkoutable->checkedOutToUser(); + } + + return $acceptance->checkoutable_type == 'App\Models\Asset' && $acceptance_checkoutable_flag; }) ->map(function($acceptance) { return ['assetItem' => $acceptance->checkoutable, 'acceptance' => $acceptance];