From 5360f6a5ac0aa138ccff011074afa5f19468d0c9 Mon Sep 17 00:00:00 2001 From: "Akintayo A. Olusegun" Date: Wed, 25 Jan 2023 13:17:36 +0100 Subject: [PATCH] setLedgerTransportPreference in the metamask-controller should not be called, or should return immediately, if canUseHardwareWallets() is false Signed-off-by: Akintayo A. Olusegun --- app/scripts/metamask-controller.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 01c692cb3b64..4d64eda27ce7 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -4415,6 +4415,10 @@ export default class MetamaskController extends EventEmitter { * @param {string} transportType - The Ledger transport type. */ async setLedgerTransportPreference(transportType) { + if (!this.canUseHardwareWallets()) { + return undefined; + } + const currentValue = this.preferencesController.getLedgerTransportPreference(); const newValue =