Skip to content

Commit

Permalink
Fix(mongoose-audit): exception when change is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 authored Apr 9, 2024
1 parent 6269a04 commit 00260c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/mongoose-audit/src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ const addAuditLogObject = (currentObject, original) => {
}
set(obj, key, data)
}
} else if (typeof change.lhs === "object") {
} else if (change.lhs && typeof change.lhs === "object") {
Object.entries(dot(change.lhs)).forEach(([subKeys, value]) => {
set(obj, `${key}.${subKeys}`, {
from: value,
type: ChangeAuditType[change.kind]
})
})
} else if (typeof change.rhs === "object") {
} else if (change.rhs && typeof change.rhs === "object") {
Object.entries(dot(change.rhs)).forEach(([subKeys, value]) => {
set(obj, `${key}.${subKeys}`, {
to: value,
Expand Down

0 comments on commit 00260c1

Please sign in to comment.