Skip to content

Commit 53b72d3

Browse files
authored
Fix possible NPE in CSFLE executor (#305)
* Fix NPE in CSFLE executor * Minor fix
1 parent d96bba5 commit 53b72d3

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

schemaregistry/rules/encryption/encrypt-executor.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,20 @@ export class FieldEncryptionExecutor extends FieldRuleExecutor {
9393
}
9494

9595
if (this.config != null) {
96-
for (let [key, value] of config) {
97-
let v = this.config.get(key)
98-
if (v != null) {
99-
if (v !== value) {
100-
throw new RuleError('rule config key already set: {key}')
96+
if (config != null) {
97+
for (let [key, value] of config) {
98+
let v = this.config.get(key)
99+
if (v != null) {
100+
if (v !== value) {
101+
throw new RuleError('rule config key already set: {key}')
102+
}
103+
} else {
104+
this.config.set(key, value)
101105
}
102-
} else {
103-
this.config.set(key, value)
104106
}
105107
}
106108
} else {
107-
this.config = config
109+
this.config = config != null ? config : new Map<string, string>()
108110
}
109111
}
110112

0 commit comments

Comments
 (0)