Skip to content

Commit 01aca29

Browse files
authored
Merge pull request #41 from tson1111/master
fix: add empty policy check in SavePolicy function.
2 parents 66091b9 + 1a94910 commit 01aca29

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

adapter.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,11 @@ func (a *Adapter) SavePolicy(model model.Model) error {
327327
}
328328
}
329329

330+
// check whether the policy is empty
331+
if len(lines) == 0 {
332+
return nil
333+
}
334+
330335
_, err = a.engine.Insert(&lines)
331336

332337
return err

0 commit comments

Comments
 (0)