From 4086f7b4d69b207432df07155b6fe519bd44a23f Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Thu, 29 Oct 2020 15:52:04 -0230 Subject: [PATCH] Fix error when `fetchParams` is null (#9757) If the swaps state is cleared in between the initial quote fetch and the subsequent poll fetch, a `TypeError` will be thrown due to `fetchParams` being set to `null`. This is of no functional consequence, as `fetchParams` _should_ be `null` in this case, and and no further action should be taken. The optional chaining operator is now used to ensure the call no longer throws. --- app/scripts/controllers/swaps.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/scripts/controllers/swaps.js b/app/scripts/controllers/swaps.js index e19185498..da3d226fe 100644 --- a/app/scripts/controllers/swaps.js +++ b/app/scripts/controllers/swaps.js @@ -111,7 +111,7 @@ export default class SwapsController { pollForNewQuotes () { this.pollingTimeout = setTimeout(() => { const { swapsState } = this.store.getState() - this.fetchAndSetQuotes(swapsState.fetchParams, swapsState.fetchParams.metaData, true) + this.fetchAndSetQuotes(swapsState.fetchParams, swapsState.fetchParams?.metaData, true) }, QUOTE_POLLING_INTERVAL) }