DEV: Ensure `censorFn` copes with null `regexpList` (#17754)

This fixes the test suite failures introduced by 862007fb18
This commit is contained in:
David Taylor 2022-08-02 11:09:51 +01:00 committed by GitHub
parent d3e8442937
commit 4bf9b73296
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import {
} from "discourse-common/utils/watched-words";
export function censorFn(regexpList, replacementLetter) {
if (regexpList.length) {
if (regexpList?.length) {
replacementLetter = replacementLetter || "■";
let censorRegexps = regexpList.map((regexp) => {
return createWatchedWordRegExp(toWatchedWord(regexp));