fix(MessageEmbed): prevent possible destructuring error

This commit is contained in:
Bence 2020-02-29 14:19:56 +01:00 committed by GitHub
parent e4f567c65e
commit bbe169deac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -411,7 +411,13 @@ class MessageEmbed {
* @returns {EmbedField[]}
*/
static normalizeFields(...fields) {
return fields.flat(2).map(({ name, value, inline }) => this.normalizeField(name, value, inline));
return fields.flat(2).map(field =>
this.normalizeField(
field && field.name,
field && field.value,
field && typeof field.inline === 'boolean' ? field.inline : false,
),
);
}
}