Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Util): remove truthy check before isNaN check #6358

Merged
merged 2 commits into from Aug 10, 2021

Conversation

zaida04
Copy link
Contributor

@zaida04 zaida04 commented Aug 9, 2021

If an invalid string is passed into resolveColor, it never actually throws a COLOR_CONVERT error and will return NaN. Why is this? Well because of this line:

else if (color && isNaN(color)) throw new TypeError('COLOR_CONVERT');

Because NaN isn't a truthy value, we don't get past that first condition to be able to check whether the color is NaN. This PR fixes that.

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating

src/util/Util.js Outdated Show resolved Hide resolved
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
@iCrawl iCrawl changed the title fix: remove truthy check before isNaN check fix(Util): remove truthy check before isNaN check Aug 10, 2021
@iCrawl iCrawl merged commit 3c17939 into discordjs:main Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants