Skip to content

Commit

Permalink
Check arguments; skip magic avatars with null url.
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Oct 9, 2018
1 parent 1ad8e5c commit 4470747
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/plugins/avatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ class Avatars {
});
}

if (typeof this.store === 'object' && typeof this.opts.publicPath !== 'string') {
throw new TypeError('`publicPath` is not set, but it is required because `store` is set.');
}

this.magicAvatars = new Map();

if (this.options.sigil) {
Expand Down Expand Up @@ -102,7 +106,7 @@ class Avatars {
type: 'magic',
name,
url,
}));
})).filter(({ url }) => url != null);
}

async setMagicAvatar(userID, name) {
Expand Down Expand Up @@ -175,7 +179,7 @@ class Avatars {
}

/**
* Use a custom avatar.
* Use a custom avatar, read from a stream.
*/
async setCustomAvatar(userID, stream) {
const { users } = this.uw;
Expand Down

0 comments on commit 4470747

Please sign in to comment.