Skip to content

Commit bf9cb44

Browse files
committed
fix: KeyError: 'g' when build_role_links
1 parent b03e65a commit bf9cb44

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

casbin/model/policy.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ def build_role_links(self, rm_map):
4444
return
4545

4646
for ptype, ast in self["g"].items():
47-
rm = rm_map[ptype]
48-
ast.build_role_links(rm)
47+
rm = rm_map.get(ptype)
48+
if rm:
49+
ast.build_role_links(rm)
4950

5051
def build_incremental_role_links(self, rm, op, sec, ptype, rules):
5152
if sec == "g":

0 commit comments

Comments
 (0)