From 3dc3d4d651048fc2b996c948fe3dcdaeb0b17eb5 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Fri, 7 May 2021 16:38:36 -0500 Subject: [PATCH] Prevent an undefined gas price from breaking the transaction list (#11015) --- ui/app/hooks/useCancelTransaction.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/app/hooks/useCancelTransaction.js b/ui/app/hooks/useCancelTransaction.js index da4312d2a..2e71c184b 100644 --- a/ui/app/hooks/useCancelTransaction.js +++ b/ui/app/hooks/useCancelTransaction.js @@ -26,9 +26,12 @@ import { multiplyCurrencies } from '../helpers/utils/conversion-util'; */ export function useCancelTransaction(transactionGroup) { const { primaryTransaction } = transactionGroup; - const gasPrice = primaryTransaction.txParams?.gasPrice?.startsWith('-') - ? '0x0' - : primaryTransaction.txParams?.gasPrice; + + const transactionGasPrice = primaryTransaction.txParams?.gasPrice; + const gasPrice = + transactionGasPrice === undefined || transactionGasPrice?.startsWith('-') + ? '0x0' + : primaryTransaction.txParams?.gasPrice; const transaction = primaryTransaction; const dispatch = useDispatch(); const selectedAccount = useSelector(getSelectedAccount);