@@ -128,10 +128,12 @@ export class InternalEnforcer extends CoreEnforcer {
128128 }
129129
130130 if ( useWatcher ) {
131- if ( this . watcher && this . autoNotifyWatcher ) {
131+ if ( this . autoNotifyWatcher ) {
132132 // In fact I think it should wait for the respond, but they implement add_policy() like this
133133 // error intentionally ignored
134- this . watcher . update ( ) ;
134+ if ( this . watcher ) {
135+ this . watcher . update ( ) ;
136+ }
135137 }
136138 }
137139
@@ -163,7 +165,7 @@ export class InternalEnforcer extends CoreEnforcer {
163165 }
164166
165167 if ( useWatcher ) {
166- if ( this . watcher && this . autoNotifyWatcher ) {
168+ if ( this . autoNotifyWatcher ) {
167169 // error intentionally ignored
168170 if ( this . watcherEx ) {
169171 this . watcherEx . updateForRemovePolicy ( sec , ptype , ...rule ) ;
@@ -203,7 +205,7 @@ export class InternalEnforcer extends CoreEnforcer {
203205 }
204206
205207 if ( useWatcher ) {
206- if ( this . watcher && this . autoNotifyWatcher ) {
208+ if ( this . autoNotifyWatcher ) {
207209 // error intentionally ignored
208210 if ( this . watcherEx ) {
209211 this . watcherEx . updateForRemovePolicies ( sec , ptype , ...rules ) ;
@@ -241,7 +243,7 @@ export class InternalEnforcer extends CoreEnforcer {
241243 }
242244
243245 if ( useWatcher ) {
244- if ( this . watcher && this . autoNotifyWatcher ) {
246+ if ( this . autoNotifyWatcher ) {
245247 // error intentionally ignored
246248 if ( this . watcherEx ) {
247249 this . watcherEx . updateForRemoveFilteredPolicy ( sec , ptype , fieldIndex , ...fieldValues ) ;
0 commit comments