element-hq / element-hq/element-web

[ISSUE] SearchWarning: Cannot read properties of undefined (reading 'get') in line #69

Open
#23,842 4 comments 0 reactions 0 assignees View on GitHub
O-Uncommon S-Tolerable T-Defect
Dominant language
TypeScript
Stars
13.5k
Forks
2.8k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

From [`src/components/views/elements/SearchWarning.tsx#L69`](https://github.com/matrix-org/matrix-react-sdk/blob/ad190b1dcc8aa332b9492c9dc8508e25c2914d94/src/components/views/elements/SearchWarning.tsx#L69), the exception `TypeError: Cannot read properties of undefined (reading 'get')` is thrown when clicking on the room header search button (`mx_RoomHeader_searchButton`) if `desktop_builds` is not defined in config.

Adding the optional chaining operator `?.` in line # 69, like `if (desktopBuilds?.get("available")) {`, would fix this issue.

### Outcome

Exception

### Operating system

_No response_

### Browser information

_No response_

### URL for webapp

_No response_

### Application version

_No response_

### Homeserver

_No response_

### Will you send logs?

No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.