Skip to content

Commit 4470747

Browse files
committed
Check arguments; skip magic avatars with null url.
1 parent 1ad8e5c commit 4470747

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/plugins/avatars.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ class Avatars {
5656
});
5757
}
5858

59+
if (typeof this.store === 'object' && typeof this.opts.publicPath !== 'string') {
60+
throw new TypeError('`publicPath` is not set, but it is required because `store` is set.');
61+
}
62+
5963
this.magicAvatars = new Map();
6064

6165
if (this.options.sigil) {
@@ -102,7 +106,7 @@ class Avatars {
102106
type: 'magic',
103107
name,
104108
url,
105-
}));
109+
})).filter(({ url }) => url != null);
106110
}
107111

108112
async setMagicAvatar(userID, name) {
@@ -175,7 +179,7 @@ class Avatars {
175179
}
176180

177181
/**
178-
* Use a custom avatar.
182+
* Use a custom avatar, read from a stream.
179183
*/
180184
async setCustomAvatar(userID, stream) {
181185
const { users } = this.uw;

0 commit comments

Comments
 (0)