Skip to content

Commit

Permalink
null check config.rate and config.defaultRate (#12175)
Browse files Browse the repository at this point in the history
  • Loading branch information
olafbuitelaar committed Aug 29, 2024
1 parent 76e74a7 commit 14b3b35
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 14b3b35

Please sign in to comment.