Fix Cannot read property toLowerCase of undefined

pull/4472/head
Viktor Baranov 3 years ago
parent 25ae47dab2
commit 61ddfa336d
  1. 1
      CHANGELOG.md
  2. 9
      apps/block_scout_web/assets/js/lib/autocomplete.js

@ -3,6 +3,7 @@
### Features
### Fixes
- [#4472](https://github.com/blockscout/blockscout/pull/4472) - Search autocomplete: Fix Cannot read property toLowerCase of undefined
- [#4456](https://github.com/blockscout/blockscout/pull/4456) - URL encoding for NFT media files URLs
- [#4453](https://github.com/blockscout/blockscout/pull/4453) - Unescape characters for string output type in the contract response
- [#4401](https://github.com/blockscout/blockscout/pull/4401) - Fix displaying of token holders with the same amount

@ -43,9 +43,12 @@ const resultsListElement = (list, data) => {
fetchTextAdData()
}
const searchEngine = (query, record) => {
if (record.name.toLowerCase().includes(query.toLowerCase()) ||
record.symbol.toLowerCase().includes(query.toLowerCase()) ||
record.contract_address_hash.toLowerCase().includes(query.toLowerCase())) {
if (record && (
(record.name && record.name.toLowerCase().includes(query.toLowerCase())) ||
(record.symbol && record.symbol.toLowerCase().includes(query.toLowerCase())) ||
(record.contract_address_hash && record.contract_address_hash.toLowerCase().includes(query.toLowerCase()))
)
) {
var searchResult = `${record.contract_address_hash}<br/>`
if (record.type === 'label') {
searchResult += `<div class="fontawesome-icon tag"></div><span> <b>${record.name}</b></span>`

Loading…
Cancel
Save