aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2022-04-04 17:01:18 +0200
committerGitHub <[email protected]>2022-04-04 15:01:18 +0000
commitfb1b87e2249798c6257cb5383f73a15022f438f0 (patch)
treed20171e5380cfc448422fdcb87bbb1b11aebcf55 /src
parent8b545b4e72e0d00f93d51f8de876103bedebff03 (diff)
downloadfaker-fb1b87e2249798c6257cb5383f73a15022f438f0.tar.xz
faker-fb1b87e2249798c6257cb5383f73a15022f438f0.zip
fix: random word fails on undefined (#771)
Diffstat (limited to 'src')
-rw-r--r--src/random.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/random.ts b/src/random.ts
index a653472f..448cf4f8 100644
--- a/src/random.ts
+++ b/src/random.ts
@@ -326,7 +326,7 @@ export class Random {
const randomWordMethod = this.faker.random.arrayElement(wordMethods);
result = randomWordMethod();
- } while (bannedChars.some((char) => result.includes(char)));
+ } while (!result || bannedChars.some((char) => result.includes(char)));
return this.faker.random.arrayElement(result.split(' '));
}