From 3a5716789f72cbd2557a88582f5d2234c7e29c9d Mon Sep 17 00:00:00 2001 From: dennemark Date: Thu, 26 Sep 2024 18:44:13 +0200 Subject: [PATCH] fix: :bug: store permission on null not possible --- src/storePermissions.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/storePermissions.ts b/src/storePermissions.ts index ad2e696..083a98a 100644 --- a/src/storePermissions.ts +++ b/src/storePermissions.ts @@ -8,12 +8,14 @@ export function storePermissions(result: any, abilities: PureAbility { - entry[prop] = [] - actions.forEach((action) => { - if (abilities.can(action, getSubject(model, entry))) { - entry[prop].push(action) - } - }) + if (entry) { + entry[prop] = [] + actions.forEach((action) => { + if (abilities.can(action, getSubject(model, entry))) { + entry[prop].push(action) + } + }) + } return entry } if (Array.isArray(result)) {