fix: Add null safety checks in GlobalSearchModal (#5625)

* fix: Add null safety checks in GlobalSearchModal
This commit is contained in:
Pooja
2025-09-24 13:57:58 +05:30
committed by lohit-bruno
parent 86727c8525
commit c8da13bd9b

View File

@@ -73,7 +73,8 @@ const GlobalSearchModal = ({ isOpen, onClose }) => {
const itemPathLower = itemPath.toLowerCase();
if (isItemARequest(item)) {
const nameMatch = searchTerms.every(term => item.name.toLowerCase().includes(term));
// add an optional check for the item name to prevent a crash if it doesnt exist.
const nameMatch = searchTerms.every(term => (item.name || '').toLowerCase().includes(term));
const urlMatch = searchTerms.every(term => (item.request?.url || '').toLowerCase().includes(term));
const pathMatch = enablePathMatch && searchTerms.every(term => itemPathLower.includes(term));