Skip to content

Commit 1a94910

Browse files
committed
fix: add empty policy check in SavePolicy function.
Signed-off-by: Cong Ding <masdc98@icloud.com>
1 parent 66091b9 commit 1a94910

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

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)