Skip to content

Commit

Permalink
fix: exclude null values when checking ability
Browse files Browse the repository at this point in the history
  • Loading branch information
0xfede committed Dec 9, 2022
1 parent e1fb8d5 commit d8a0683
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export function checkAbility(ability: AnyMongoAbility, resource: string, action:
const fieldsCache = new Map<string, boolean>();
function innerCheckAbility(data: any, path?: string[]): any {
let foundOne = false;
if (typeof data === 'object' && !ObjectId.isValid(data) && !(data instanceof Date)) {
if (typeof data === 'object' && data !== null && !ObjectId.isValid(data) && !(data instanceof Date)) {
if (Array.isArray(data)) {
data = data.filter((i) => {
try {
Expand Down

0 comments on commit d8a0683

Please sign in to comment.