Skip to content

Commit

Permalink
SavePolicy: use empty maps when undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Joakim committed Oct 29, 2019
1 parent 6b46d9d commit 314987b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ class MongooseAdapter {

try {
const lines = [];
const policyRuleAST = model.model.get('p');
const groupingPolicyAST = model.model.get('g');
const policyRuleAST = model.model.get('p') instanceof Map ? model.model.get('p') : new Map();
const groupingPolicyAST = model.model.get('g') instanceof Map ? model.model.get('g') : new Map();

for (const [ptype, ast] of policyRuleAST) {
for (const rule of ast.policy) {
Expand Down

0 comments on commit 314987b

Please sign in to comment.