From 3a01156078c1fed7c10523b8c8c0cd765b18cd9a Mon Sep 17 00:00:00 2001 From: Antonio Ribeiro Date: Tue, 9 Jan 2024 01:59:22 +0100 Subject: [PATCH] Fix user list errors when deleting roles (#2372) Co-authored-by: Quentin Renard --- src/Repositories/Behaviors/HandleUserPermissions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Repositories/Behaviors/HandleUserPermissions.php b/src/Repositories/Behaviors/HandleUserPermissions.php index a58f8de1f..3218e054b 100644 --- a/src/Repositories/Behaviors/HandleUserPermissions.php +++ b/src/Repositories/Behaviors/HandleUserPermissions.php @@ -25,6 +25,11 @@ public function getFormFieldsHandleUserPermissions($object, $fields) foreach ($object->permissions()->moduleItem()->get() as $permission) { $model = $permission->permissionable()->first(); + + if ($model === null) { + continue; + } + $moduleName = getModuleNameByModel($model); $fields[$moduleName . '_' . $model->id . '_permission'] = $permission->name; }