element-hq / element-hq/element-web
[ISSUE] SearchWarning: Cannot read properties of undefined (reading 'get') in line #69
- 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
Assessment
This issue has not been assessed yet.