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

fix: cherry pick swaps undefined object access crash hotfix into v12.4.1 RC #27757

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

## [12.4.1]
### Fixed
- Fix crash on swaps review page ([27708](https://github.com/MetaMask/metamask-extension/pull/27708))

## [12.4.0]
### Added
Expand Down
4 changes: 3 additions & 1 deletion ui/pages/swaps/prepare-swap-page/prepare-swap-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
getTransactionSettingsOpened,
setTransactionSettingsOpened,
getLatestAddedTokenTo,
getUsedQuote,
} from '../../../ducks/swaps/swaps';
import {
getSwapsDefaultToken,
Expand Down Expand Up @@ -190,9 +191,10 @@ export default function PrepareSwapPage({
const rpcPrefs = useSelector(getRpcPrefsForCurrentProvider, shallowEqual);
const tokenList = useSelector(getTokenList, isEqual);
const quotes = useSelector(getQuotes, isEqual);
const usedQuote = useSelector(getUsedQuote, isEqual);
const latestAddedTokenTo = useSelector(getLatestAddedTokenTo, isEqual);
const numberOfQuotes = Object.keys(quotes).length;
const areQuotesPresent = numberOfQuotes > 0;
const areQuotesPresent = numberOfQuotes > 0 && usedQuote;
const swapsErrorKey = useSelector(getSwapsErrorKey);
const aggregatorMetadata = useSelector(getAggregatorMetadata, shallowEqual);
const transactionSettingsOpened = useSelector(
Expand Down