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

null check config.rate and config.defaultRate in currency module #12175

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ export let responseReady = defer();
export function setConfig(config) {
ratesURL = DEFAULT_CURRENCY_RATE_URL;

if (typeof config.rates === 'object') {
if (config.rates !== null && typeof config.rates === 'object') {
currencyRates.conversions = config.rates;
currencyRatesLoaded = true;
needToCallForCurrencyFile = false; // don't call if rates are already specified
}

if (typeof config.defaultRates === 'object') {
if (config.defaultRates !== null && typeof config.defaultRates === 'object') {
defaultRates = config.defaultRates;

// set up the default rates to be used if the rate file doesn't get loaded in time
Expand Down