Skip to content

Commit

Permalink
Merge pull request #41 from tson1111/master
Browse files Browse the repository at this point in the history
fix: add empty policy check in SavePolicy function.
  • Loading branch information
hsluoyz authored May 13, 2021
2 parents 66091b9 + 1a94910 commit 01aca29
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,11 @@ func (a *Adapter) SavePolicy(model model.Model) error {
}
}

// check whether the policy is empty
if len(lines) == 0 {
return nil
}

_, err = a.engine.Insert(&lines)

return err
Expand Down

0 comments on commit 01aca29

Please sign in to comment.